login
Number of 1's in the Stolarsky representation of n.
10

%I #50 Apr 28 2024 11:39:19

%S 0,1,2,1,3,2,2,4,1,3,3,3,5,2,2,4,2,4,4,4,6,1,3,3,3,5,3,3,5,3,5,5,5,7,

%T 2,2,4,2,4,4,4,6,2,4,4,4,6,4,4,6,4,6,6,6,8,1,3,3,3,5,3,3,5,3,5,5,5,7,

%U 3,3,5,3,5,5,5,7,3,5,5,5,7,5,5,7,5,7,7

%N Number of 1's in the Stolarsky representation of n.

%C For the Stolarsky representation of n, see the C. Mongoven link.

%H Amiram Eldar, <a href="/A200649/b200649.txt">Table of n, a(n) for n = 1..10000</a>

%H Casey Mongoven, <a href="/A200648/a200648.txt">Description of Stolarsky Representations</a>.

%F 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]

%F a(n) = A200648(n) - A200650(n). - _Amiram Eldar_, Jul 07 2023

%e The Stolarsky representation of 19 is 11101. This has 4 1's. So a(19) = 4.

%t 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}]]];

%t a[n_] := Count[stol[n], 1]; Array[a, 100] (* _Amiram Eldar_, Jul 07 2023 *)

%o (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])));}

%o a(n) = vecsum(stol(n)); \\ _Amiram Eldar_, Jul 07 2023

%Y Cf. A072649, A130312, A135818, A200648, A200650, A200651.

%K nonn,base

%O 1,3

%A _Casey Mongoven_, Nov 19 2011

%E More terms from _Amiram Eldar_, Jul 07 2023