A352339 a(n) is the maximal (or lazy) Pell representation of n using a ternary system of vectors.
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
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
Links
- Amiram Eldar, Table of n, a(n) for n = 0..10000
- 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
Crossrefs
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]
Comments