OFFSET
1,6
COMMENTS
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
For n = 8 = 2^3, the dual Zeckendorf representation of 3 is 11, i.e., 3 = Fibonacci(2) + Fibonacci(3) = 1 + 2. Therefore 8 = 2^(1+2) = 2^1 * 2^2, and a(8) = 2.
For n = 256 = 2^8, the dual Zeckendorf representation of 8 is 1011, i.e., 8 = Fibonacci(2) + Fibonacci(3) + Fibonacci(5) = 1 + 2 + 5. Therefore 256 = 2^(1+2+5) = 2^1 * 2^2 * 2^5, and a(256) = 3.
MATHEMATICA
toDualZeck[n_] := Module[{s = 0, v = 0, i = 0, f}, While[s < n, s += Fibonacci[i + 2]; v += 2^i; i++]; i--; While[i >= 0, f = Fibonacci[i + 2]; If[s - f >= n, s -= f; v -= 2^i]; i--]; v]; (* A003754, after Rémy Sigrist's PARI code in A112309 *)
f[p_, e_] := DigitCount[toDualZeck[e], 2, 1]; a[1] = 0; a[n_] := Plus @@ f @@@ FactorInteger[n]; Array[a, 100]
PROG
(PARI) todualzeck(n) = {my (s=0, v=0); for (i=0, oo, if (s>=n, forstep (j=i-1, 0, -1, if (s-fibonacci(2+j)>=n, s-=fibonacci(2+j); v-=2^j; ); ); return (v); ); s+=fibonacci(2+i); v+=2^i; ); } \\ A003754, Rémy Sigrist's code in A112309
a(n) = vecsum(apply(x -> hammingweight(todualzeck(x)), factor(n)[, 2]));
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Amiram Eldar, Aug 09 2024
STATUS
approved