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.

A178049 The number of iterations of the map x -> x + d(x) to reach a repdigit (cf. A010785), starting at n, where the decimals of d(x) are the first differences of the decimals of x.

Original entry on oeis.org

2, 1, 7, 6, 7, 5, 3, 6, 8, 4, 2, 2, 1, 5, 4, 7, 3, 3, 6, 8, 2, 2, 2, 1, 5, 4, 7, 3, 3, 6, 2, 2, 2, 2, 1, 5, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 5, 4, 3, 3, 2, 2, 2, 2, 2, 2, 1, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 2
Offset: 10

Views

Author

Michel Lagneau, May 18 2010

Keywords

Comments

Let the recurrence X(k+1) = X(k) + Y(k) with the initial values : X(0) = n, and {x(1), x(2),...,x(p) } is the decimal expansion of n ; Y(0) has the decimal expansion {y(2), y(3),...,y(p)} where y(i) = abs(x(i)- x(i-1)), i = 2,..., p. For n > = 10, a(n) is the number of iterations of Y(k) needed to reach 0.
According to the computations with the Maple program for big numbers, the recurrence converges. Y(k) tends towards zero after a number of finite iterations, and X(k) tends towards a number q with the decimal expansion {p,p, ...,p }.

Examples

			a(11) = 1 because 11 + (1-1) = 11 + 0, and 0 is obtained after the first iteration.
a(12) = 7 because 12 + 1 = 13 -> 13 + 2 = 15 -> 15 + 4= 19 -> 19 + 8 = 27-> 27 + 5 = 32 -> 32 + 1 = 33 -> 33 + 0 = 33 is the last number of the cycle, and 0 is obtained after the 7th iteration.
		

Crossrefs

Cf. A010785.

Programs

  • Maple
    for n from 10 to 200 do:n0:=n:s:=1:for i from 1 to 10^6 while(s<>0) do:x:=convert(n0,base,10):n1:=nops(x):s:=sum(abs(x[j+1]-x[j]),j=1..n1-1):n0:=n0+s:it:=i:od: printf(`%d, `, it):od: