OFFSET
1,3
COMMENTS
For the Stolarsky representation of n, see the C. Mongoven link.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
Casey Mongoven, Description of Stolarsky Representations.
FORMULA
a(n) = a(n - A130312(n-1)) + (A072649(n-1) - A072649(n - A130312(n-1) - 1)) mod 2 for n > 2 with a(1) = 0, a(2) = 1. - Mikhail Kurkov, Oct 19 2021 [verification needed]
EXAMPLE
The Stolarsky representation of 19 is 11101. This has 4 1's. So a(19) = 4.
MATHEMATICA
stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
a[n_] := Count[stol[n], 1]; Array[a, 100] (* Amiram Eldar, Jul 07 2023 *)
PROG
(PARI) stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1]))); }
a(n) = vecsum(stol(n)); \\ Amiram Eldar, Jul 07 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Casey Mongoven, Nov 19 2011
EXTENSIONS
More terms from Amiram Eldar, Jul 07 2023
STATUS
approved