Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #9 Jan 05 2025 19:51:42
%S 0,1,1,2,2,3,4,2,3,3,4,5,3,4,4,5,3,4,5,3,4,4,5,6,4,5,5,6,4,5,6,4,5,5,
%T 6,7,5,6,6,7,8,4,5,5,6,4,5,6,4,5,5,6,7,5,6,6,7,5,6,7,5,6,6,7,8,6,7,7,
%U 8,9,5,6,6,7,5,6,7,5,6,6,7,8,6,7,7,8,6
%N a(n) is the sum of digits of n in the maximal Pell representation of n (A352339).
%H Amiram Eldar, <a href="/A352340/b352340.txt">Table of n, a(n) for n = 0..10000</a>
%H A. F. Horadam, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/32-3/horadam2.pdf">Maximal representations of positive integers by Pell numbers</a>, The Fibonacci Quarterly, Vol. 32, No. 3 (1994), pp. 240-244.
%F a(n) = A007953(A352339(n)).
%F a(n) >= A265744(n).
%t pell[1] = 1; pell[2] = 2; pell[n_] := pell[n] = 2*pell[n - 1] + pell[n - 2]; pellp[n_] := Module[{s = {}, m = n, k}, While[m > 0, k = 1; While[pell[k] <= m, k++]; k--; AppendTo[s, k]; m -= pell[k]; k = 1]; IntegerDigits[Total[3^(s - 1)], 3]]; a[n_] := Module[{v = pellp[n]}, nv = Length[v]; i = 1; While[i <= nv - 2, If[v[[i]] > 0 && v[[i + 1]] == 0 && v[[i + 2]] < 2, v[[i ;; i + 2]] += {-1, 2, 1}; If[i > 2, i -= 3]]; i++]; i = Position[v, _?(# > 0 &)]; If[i == {}, 0, Total[v[[i[[1, 1]] ;; -1]]]]]; Array[a, 100, 0]
%Y Cf. A000129, A007953, A352339.
%Y Similar sequences: A053735, A007895, A112310, A265744, A278043, A352104.
%K nonn,base
%O 0,4
%A _Amiram Eldar_, Mar 12 2022