[Editor's comment] The sieve part of the title is from me. The comments from the asker revealed that this what they are hoping to build. JL. [/Editor's comment]
So, basically what I need is something like this:

You can see fairly regular peaks and the function seems to be 0 elsewhere, but it's not. It's just quite small.
What I need is a function that:
- Is greater than 0 where its peak is (even a bit around it is ok)
- Is 0 where its neighbour numbers are
(In the picture shown, I want it to be 0 where 3, 5, 7, 9 etc... are. It can be a bit greater than 0 where 2.95 or 3.05 is, I don't care. It just needs to be 0 where 3 is, and the other numbers are).

Here you can see peake where 3, 6, 9 etc... are, but I need the function to be exactly 0 where 1, 2, 4, 5, 7, 8, etc... are. I don't care how it behaves in between the numbers, as long as it's 0 where those numbers are and greater than 0 (preferably =1) elsewhere.
One more thing:
- It needs to be a single equation and not a split one.
Is it possible?
EDIT: My goal is to construct an equation that finds prime numbers by looking at the zeroes in this function.
This has been obtained by 'stacking' the cosine wave functions for multiples of 2, 3, 5 and 7. You can see quite easily that 11 and 13 are marked as 0, but since the function is not exactly 0, but a bit above it when the numbers are possible primes, the error builds up and the function is not reliable anymore after we stack too many of them.
The one in the last picture was this:
999999999999^(cos(2pix/2))/999999999999+999999999999^(cos(2pix/3))/999999999999+999999999999^(cos(2pix/5))/999999999999+999999999999^(cos(2pix/7))/999999999999
It is just a sloppy approximation, but shows the concept quite well I guess.

How about $\cos(\pi x/2)^{2n} $ for $n \in \{1,2,3,...\}$? One for even numbers, zero for odd numbers.