%I #19 Jan 05 2025 19:51:40
%S 0,1,1,2,2,1,2,2,3,3,2,3,1,2,2,3,3,2,3,3,4,4,3,4,2,3,3,4,4,1,2,2,3,3,
%T 2,3,3,4,4,3,4,2,3,3,4,4,3,4,4,5,5,4,5,3,4,4,5,5,2,3,3,4,4,3,4,4,5,5,
%U 4,5,1,2,2,3,3,2,3,3,4,4,3,4,2,3,3,4,4,3,4,4,5,5,4,5,3,4,4,5,5,2,3,3,4,4,3,4,4,5,5,4,5,3
%N a(n) is the number of Pell numbers (A000129) needed to sum to n using the greedy algorithm (A317204).
%C a(0) = 0, because no numbers are needed to form an empty sum, which is zero.
%C It would be nice to know for sure whether this sequence also gives the least number of Pell numbers that add to n, i.e., that there cannot be even better nongreedy solutions.
%D A. F. Horadam, Zeckendorf representations of positive and negative integers by Pell numbers, Applications of Fibonacci Numbers, Springer, Dordrecht, 1993, pp. 305-316.
%H Antti Karttunen, <a href="/A265744/b265744.txt">Table of n, a(n) for n = 0..13860</a>
%H L. Carlitz, Richard Scoville, and V. E. Hoggatt, Jr., <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/10-5/carlitz1.pdf">Pellian Representations</a>, The Fibonacci Quarterly, Vol. 10, No. 5 (1972), pp. 449-488.
%F a(n) = A007953(A317204(n)). - _Amiram Eldar_, Mar 12 2022
%t pell[1] = 1; pell[2] = 2; pell[n_] := pell[n] = 2*pell[n - 1] + pell[n - 2]; a[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]; Plus @@ IntegerDigits[Total[3^(s - 1)], 3]]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 12 2022 *)
%Y Cf. A000129, A007953, A317204.
%Y Cf. also A014420, A053610, A265404, A265743, A265745.
%Y Similar sequences: A007895, A116543, A278043.
%K nonn,base
%O 0,4
%A _Antti Karttunen_, Dec 17 2015