Get count after dividided by certain numbers


I am able to print the numbers using (1 to 100).filter(i => i % 3 != 0 || i % 5 != 0 || i % 2 != 0)syntax. But at the same time I want to get the count of those numbers.

(1 to 100).filter(i => i % 3 != 0 || i % 5 != 0 || i % 2 != 0) && i.length)
But I am not get the count.
Could some one help how to get count.


I think someone has said this - why are you asking these questions here? Anyway, the count is:
(1 to 100).filter(i => i % 3 != 0 || i % 5 != 0 || i % 2 != 0).length


Thanks sidhartha. I am not sure who asked. I am learning scala.
I am new to this programming language.
If someone asked could you please share that link I will go through that.

This is not a place for such a discussion, but this seems a peculiar way to learn scala (or anything else). Where does this collection of problems come from? Surely the same source has some explanations and examples. There is a clear mismatch in the level of the questions you ask (reasonably advanced) and the level of mistakes you make (like i.length, where i is not in scope and is an element of the list, not a list so cannot have a length).


Thanks one more time sidharta.
My intention was that to go through the discussion not more than that. Every one will have their thoughts and way of asking the things will be different from person to person. That is the I want to go through that particular thread.There was nothing else.