login
A352339
a(n) is the maximal (or lazy) Pell representation of n using a ternary system of vectors.
7
0, 1, 10, 11, 20, 21, 22, 110, 111, 120, 121, 122, 210, 211, 220, 221, 1020, 1021, 1022, 1110, 1111, 1120, 1121, 1122, 1210, 1211, 1220, 1221, 2020, 2021, 2022, 2110, 2111, 2120, 2121, 2122, 2210, 2211, 2220, 2221, 2222, 10210, 10211, 10220, 10221, 11020, 11021
OFFSET
0,3
COMMENTS
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]
LINKS
A. F. Horadam, Maximal representations of positive integers by Pell numbers, The Fibonacci Quarterly, Vol. 32, No. 3 (1994), pp. 240-244.
OEIS Wiki, Empty sum
EXAMPLE
a(5) = 21 since 5 = 2*2 + 1.
a(6) = 22 since 6 = 2*2 + 2.
a(7) = 110 since 7 = 5 + 2.
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
MATHEMATICA
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]
CROSSREFS
Similar sequences: A104326 (Fibonacci), A130311 (Lucas), A352103 (tribonacci).
Sequence in context: A165265 A329818 A329447 * A197652 A261909 A325483
KEYWORD
nonn,base
AUTHOR
Amiram Eldar, Mar 12 2022
STATUS
approved