|
|
|
|
1, 0, 3, 3, 2, 1, 1, 2, 5, 7, 6, 7, 7, 6, 7, 5, 4, 1, 3, 4, 11, 13, 2, 5, 5, 2, 13, 11, 4, 3, 1, 4, 7, 3, 12, 13, 15, 12, 13, 9, 8, 3, 5, 8, 9, 11, 14, 11, 11, 14, 11, 9, 8, 5, 3, 8, 9, 13, 12, 15, 13, 12, 3, 7, 6, 1, 13, 14, 11, 7, 4, 9, 11, 4, 25, 21, 22, 27, 7, 14, 13, 5, 24, 27, 29, 24, 31, 23, 20, 29, 31, 20, 23, 25, 2, 9, 9, 2, 25, 23, 20, 31, 29, 20, 23
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[BitXor[a[n - 1], a@ n], {n, 120}] (* Michael De Vlieger, Mar 22 2017 *)
|
|
PROG
|
(PARI) A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
for(n=1, 120, print1(bitxor(A(n - 1), A(n)), ", ")) \\ Indranil Ghosh, Mar 23 2017
(Python)
from functools import reduce
def A283987(n): return sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n)[-1:2:-1], (1, 0)))^sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n-1)[-1:2:-1], (1, 0))) if n>1 else 1 # Chai Wah Wu, May 05 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|