OFFSET
0,3
LINKS
FORMULA
a(n) <= n with equality iff n = 0 or n belongs to A143071.
a(2*n) = 2*a(n).
EXAMPLE
For n = 27:
- we have the following triangle:
27
9 18
3 10 24
1 2 8 16
- so a(27) = 27.
PROG
(PARI) a(n) = { my (b=vector(hammingweight(n))); for (k=1, #b, n-=b[k]=2^valuation(n, 2)); while (#b>1, b=vector(#b-1, k, bitxor(b[k+1], b[k]))); if (#b, b[1], 0) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 18 2022
STATUS
approved