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.

A329200 The ghost iteration (A): add or subtract the number formed by absolute differences of digits (A040115), according to parity (even or odd).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 11, 11, 15, 11, 19, 11, 23, 11, 27, 22, 20, 22, 22, 26, 22, 30, 22, 34, 22, 27, 33, 31, 33, 33, 37, 33, 41, 33, 45, 44, 38, 44, 42, 44, 44, 48, 44, 52, 44, 45, 55, 49, 55, 53, 55, 55, 59, 55, 63, 66, 56, 66, 60, 66, 64, 66, 66, 70, 66, 63, 77, 67, 77, 71, 77
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Nov 09 2019

Keywords

Comments

Sequence A040115 is most naturally extended to 0 (empty sum) for single-digit arguments; that's what we use here. This value is added to n if even, subtracted if odd.
Repdigit numbers are the fixed points. Other starting values end in nontrivial loops under iterations of this map, like 11090 -> 10891 -> 12709 -> 11130 -> 11107 -> 11090 etc. Table A329196 lists these cycles, A329197 their lengths.
A329198 gives the size of n's orbit, i.e., the length of the trajectory until the terminating cycle is covered.

Examples

			For n = 101, the number formed by the absolute differences of digits is 11, since this is odd it is subtracted from n, so a(101) = 101-11 = 90.
		

Crossrefs

Cf. A040115, A329201 (variant B: add/subtract if odd/even).
Cf. A329196 (cycles), A329197 (lengths), A329198 (size of orbit of n).

Programs

  • PARI
    apply( A329200(n)={n+(-1)^(n=fromdigits(abs((n=digits(n+!n))[^-1]-n[^1])))*n}, [1..199])

Formula

a(n) = n + (-1)^d*d where d = A040115(n), 0 for n < 10.