Generate an aperiodic integer sequence Your task is to build a piece of code that generates an aperiodic sequence of integers, either by outputting one every time it iterates, or by taking an integer n and returning the nth number in that sequence.

Now, the sequence 1, 2, 3, 4, 5, 6, ... is itself aperiodic, so I'm going to introduce a few limitations to the definition of "aperiodic" used in this problem to weed out the trivial cases:


The sequence must not be periodic modulo any integer m &gt; 1. So a sequence like the powers of 2 would repeat 2, 4, 8, 6 all the time modulo 10, and therefore not count. (It would also repeat 0 modulo 2.)
The sequence must not become periodic after a certain number of operations - e.g. 1 2 4 8 6 2 4 8 6 ... is still considered periodic even though 1 never appears again.
The generation code must only use integers. So a piece of code that calculated the nth digit of pi (without calculating it in some integer form first) would not be acceptable.


Now, obviously every sequence performed with limited computer memory will eventually either be periodic or run out of memory, but if you can prove that your function, given infinite memory and time, will never loop back to a previous state, then it is acceptable.

The shortest code that does the above wins.
Golfscript, 2 characters
`,

(stringify (`) the number and count (,) the digits)
J, 3 characters
#q:

is the count (#) of the prime factors (q:) of its input.
The vector form involves more bookkeeping, but that's not our contestant:
#@q:L:0&amp;.&lt;

the first 40 terms are: 0 1 1 2 1 2 1 3 2 2 1 3 1 2 2 4 1 3 1 3 2 2 1 4 2 2 3 3 1 3 1 5 2 2 2 4 1 2 2 4
see more at OEIS
The sequence is 1 at every prime position, 2 at every prime multiple of a prime, 3 at every prime multiple of a product of two primes...

If you are not convinced this is aperiodic, here are plenty of other sequences:
##:

(the number of bits = floor of the base-2 logarithm)
+/#:

(count of 1-bits in the binary representation of the number). This (reduced under any modulus)
#b#:
+/b#:

(the same in base-b)
&lt;.^.
&gt;.^.
&lt;.b^.
&gt;.b^.

(floor or ceiling of the (natural) log - this time without stringification)
*./#:
+./b#:
*./b#:

(GCD or LCM of all base-b digits (except GCD of bits won't work))
1{#:!
9{#:!
({#:@!)

(second/tenth/nth highest bit of the factorial of n)
(=&lt;.&amp;.%:)

(Is the number equal its floor under the square root operation? Is the number equal the square of the floor of its square root? Is the number a square?)