cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Mar 12 2022

Keywords

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]

Examples

			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
		

Crossrefs

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

Programs

  • 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]