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.

A384128 Number of iterations for the circular absolute first-difference on decimal digits to reach a repdigit.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 2, 3, 5, 6, 5, 6
Offset: 1

Views

Author

Keywords

Comments

a(n) = least t >= 0 such that the t-fold iteration of the circular absolute first-difference applied to the decimal digits of n yields a repdigit. The map sends n with decimal digits d_{k-1}...d_0 to the number whose digits are |d_{k-1}-d_{k-2}|, |d_{k-2}-d_{k-3}|, ..., |d_{0}-d_{k-1}|. Let F(n) = Sum_{i=0..k-1} |floor(n/10^i) mod 10 - floor(n/10^{(i+1) mod k}) mod 10|* 10^i. Then a(n) = min {t >= 0 : F^t(n) has all digits equal}.
a(n)=0 iff all decimal digits of n are equal.
a(n) <= 11 for n < 10000.

Examples

			The first value > 1 is a(100) = 3.
a(21) = |2-1| |1-2| = 11 -> repdigit at t = 1, so a(21) = 1.
a(109) = 109 -> 198 -> 817 -> 761 -> 156 -> 415 -> 341 -> 132 -> 211 -> 101 -> 110 -> 11 requires 11 steps, so a(109) = 11.
		

Crossrefs

Cf. A010785.

Programs

  • Mathematica
    SingleRepQ[x_Integer] := SameQ @@ IntegerDigits[x]
    CAD[x_Integer] := FromDigits@Abs[IntegerDigits[x] - RotateLeft[IntegerDigits[x]]]
    A384128[n_Integer] := Module[{x = n, cnt = 0}, While[! SingleRepQ[x], x = CAD[x]; cnt++]; cnt]
    Table[A384128[n], {n, 1, 200}]

Extensions

Data corrected by Sean A. Irvine, Jun 13 2025