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.

A057138 Add (n mod 10)*10^(n-1) to the previous term, with a(0) = 0.

Original entry on oeis.org

0, 1, 21, 321, 4321, 54321, 654321, 7654321, 87654321, 987654321, 987654321, 10987654321, 210987654321, 3210987654321, 43210987654321, 543210987654321, 6543210987654321, 76543210987654321, 876543210987654321
Offset: 0

Views

Author

Henry Bottomley, Aug 12 2000

Keywords

Comments

Original definition: "Concatenate next digit at left hand end."
This is misleading, since the concatenation of 0 yields the same term (leading zeros vanish), but upon the next concatenation of 1, the 0 reappears - except for a(1), which according to that description should equal a(1)=10: It is surprising that in this only case where the 0 is indeed present, it disappears upon left-concatenation of the digit 1! - M. F. Hasler, Jan 13 2013
From Hieronymus Fischer, Jan 23 2013: (Start)
A definition which is also consistent is: Start with terms 0 and 1 and then concatenate the next digit at the left hand end. If the next digit is a zero, keep this zero in mind so that the following digit is a 1 preceding a 0.
The sequence terms are the terms of A057137 in reversed digit order. Based on this understanding, the anomaly for the indices 0 and 1 where the terms are 0 and 1 instead of 0 and 10 (what one would expect) becomes self-explaining. Also, the special behavior when the zero digit is encountered becomes clear.
Examples: a(3) = 321 = Reversal(A057137(3)),
a(10) = 987654321 = Reversal(A057137(10)) = Reversal(1234567890). (End)

Crossrefs

Alternative progression for n >= 10 compared with A000422 and A014925.
Cf. A057137 for reverse.

Programs

  • Maple
    ListTools:-PartialSums([seq((k mod 10)*10^(k-1), k=0..40)]); # Robert Israel, Jun 21 2017
  • Mathematica
    Join[{c = 0}, Table[c = c + Mod[n, 10]*10^(n - 1), {n, 18}]] (* T. D. Noe, Jan 30 2013 *)
    nxt[{n_,a_}]:={n+1,a+Mod[n+1,10]10^n}; NestList[nxt,{0,0},20][[;;,2]] (* Harvey P. Dale, Apr 06 2025 *)
  • PARI
    a(n)=sum(i=0,n,i%10*10^(i-1)) \\ M. F. Hasler, Jan 13 2013

Formula

a(n) = a(n-1) + 10^(n-1)*n - 10^n*floor(n/10) = A057139(n) mod 10^n.
a(n) = floor(((q/(10^10 - 1)) + q mod 10^(n mod 10))*10^(10*floor(n/10))), where q = 987654321. - Hieronymus Fischer, Jan 03 2013
G.f.: x(1-10(10x)^9 + 9(10x)^10)/((1-x) (1-10x)^2 (1-(10x)^10)). - Robert Israel, Jun 21 2017

Extensions

Better definition from M. F. Hasler, Jan 13 2013