A051065 a(n) = A004128(n) mod 2.
0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1
Offset: 0
References
- Letter from Gary W. Adamson concerning Prouhet-Thue-Morse sequence, Nov. 11, 1999.
Links
Programs
-
Mathematica
Join[{0}, Mod[Accumulate[Table[IntegerExponent[3*n, 3], {n, 1, 100}]], 2]] (* Amiram Eldar, Jun 02 2025 *)
-
PARI
a(n)=if(n<1,0,(a(n\3)+n)%2) \\ Benoit Cloitre, Nov 21 2013
-
Python
TOP = 1000 a = [0]*TOP for n in range(1, TOP): print(a[n-1], end=',') a[n] = (n + a[n//3]) % 2 # Alex Ratushnyak, Aug 17 2012
-
Python
def A051065(n): c, m, a = 1, 3*n, 0 for k in range(1,n+1): c *= 3 if c > m: break a ^= m//c&1 return a # Chai Wah Wu, Sep 02 2025
Formula
a(0)=0, a(n) = (n + a(floor(n/3))) mod 2. - Alex Ratushnyak, Aug 17 2012
Extensions
More terms from James Sellers, Dec 11 1999
Comments