login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Length of Stolarsky representation of n.
9

%I #28 Jul 07 2023 05:40:30

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

%T 5,5,6,5,6,6,6,7,5,6,6,6,7,6,6,7,6,7,7,7,8,5,6,6,6,7,6,6,7,6,7,7,7,8,

%U 6,6,7,6,7,7,7,8,6,7,7,7,8,7,7,8,7,8,8

%N Length of Stolarsky representation of n.

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

%H Amiram Eldar, <a href="/A200648/b200648.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) = A200649(n) + A200650(n). - _Michel Marcus_, Mar 14 2023

%e The Stolarsky representation of 19 is 11101. This is of length 5. So a(19) = 5.

%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_] := If[n == 1, 1, Length[stol[n]]]; 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) = if(n == 1, 1, #stol(n)); \\ _Amiram Eldar_, Jul 07 2023

%Y Cf. A135817, A200649, A200650, A200651.

%K nonn,base

%O 1,3

%A _Casey Mongoven_, Nov 19 2011

%E More terms from _Amiram Eldar_, Jul 07 2023