A038713 a(n) = n XOR (n-1), i.e., nim-sum of sequential pairs, written in binary.
1, 11, 1, 111, 1, 11, 1, 1111, 1, 11, 1, 111, 1, 11, 1, 11111, 1, 11, 1, 111, 1, 11, 1, 1111, 1, 11, 1, 111, 1, 11, 1, 111111, 1, 11, 1, 111, 1, 11, 1, 1111, 1, 11, 1, 111, 1, 11, 1, 11111, 1, 11, 1, 111, 1, 11, 1, 1111, 1, 11, 1, 111, 1, 11, 1, 1111111, 1, 11, 1, 111, 1
Offset: 1
Examples
a(6) = 11 because 110 XOR 101 = 11 base 2.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Index entries for sequences related to Nim-sums
Programs
-
Magma
[(10^(Valuation(n, 2)+1)-1)/9: n in [1..70]]; // Vincenzo Librandi, Mar 11 2013
-
Mathematica
Table[(10^IntegerExponent[2*n, 2] - 1)/9, {n, 100}] (* Vincenzo Librandi, Mar 11 2013 *)
-
PARI
a(n)=if(n<1,0, (10^(valuation(n,2)+1)-1)/9) /* Michael Somos, Apr 28 2005 */
Formula
a(n) = (10^A001511(n) - 1)/(10 - 1).
Multiplicative with a(2^e) = (10^(e+1) - 1)/9, a(p^e) = 1 if p odd.
G.f.: Sum_{k>=0} 10^k * x^(2^k) / (1 - x^(2^k)). - Ilya Gutkovskiy, Dec 15 2020
Dirichlet g.f.: zeta(s) * 2^s/(2^s - 10). - Amiram Eldar, Sep 21 2023