login
a(n) is the maximal (or lazy) Pell representation of n using a ternary system of vectors.
7

%I #16 Oct 06 2022 14:43:17

%S 0,1,10,11,20,21,22,110,111,120,121,122,210,211,220,221,1020,1021,

%T 1022,1110,1111,1120,1121,1122,1210,1211,1220,1221,2020,2021,2022,

%U 2110,2111,2120,2121,2122,2210,2211,2220,2221,2222,10210,10211,10220,10221,11020,11021

%N a(n) is the maximal (or lazy) Pell representation of n using a ternary system of vectors.

%C There are 2 well-established systems of giving every nonnegative integer a unique representation as a sum of positive Pell numbers (A000129), 1, 2, 5, 12, 29, 70, ...: the minimal (or greedy) representation (A317204) in which any occurrence of the digit 2 is succeeded by a 0 (i.e., if a Pell number appears twice in the sum, its preceding term in the Pell sequence does not appear), and the maximal (or lazy) representation of n in which any occurrence of the digit 0 is succeeded by a 2 (i.e., if a Pell number does not appear in the sum, its preceding term in the Pell sequence appears twice). [Edited by _Amiram Eldar_ and _Peter Munn_, Oct 04 2022]

%H Amiram Eldar, <a href="/A352339/b352339.txt">Table of n, a(n) for n = 0..10000</a>

%H A. F. Horadam, <a href="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.

%H OEIS Wiki, <a href="http://oeis.org/wiki/Empty_sum">Empty sum</a>

%e a(5) = 21 since 5 = 2*2 + 1.

%e a(6) = 22 since 6 = 2*2 + 2.

%e a(7) = 110 since 7 = 5 + 2.

%e We read the first term, 0, like the others, as a list of ternary digits. It has no 1s or 2s in it, so 0 here indicates a sum of 0 Pell numbers. This is called an "empty sum" (see Wiki link) and its total is 0. So 0 represents 0. - _Peter Munn_, Oct 04 2022

%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, FromDigits[v[[i[[1, 1]] ;; -1]]]]]; Array[a, 100, 0]

%Y Cf. A000129, A317204.

%Y Similar sequences: A104326 (Fibonacci), A130311 (Lucas), A352103 (tribonacci).

%K nonn,base

%O 0,3

%A _Amiram Eldar_, Mar 12 2022