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.

A375590 Numbers m such that there exists a nonnegative integer k for which the concatenation of m, m-1, ..., m-k is an m-digit number.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 150, 153, 156, 159, 162, 165, 168
Offset: 1

Views

Author

Nicholas M. R. Frieler, Aug 19 2024

Keywords

Comments

Let d be the number of digits of m (in base 10). One can show that the number m is a member of this sequence if and only if:
(a) m is divisible by d and m >= 10^(d-1) * d/(d+1)
or
(b) 10^(d-1) == 1 (mod d-1) (i.e., d-1 is a term of A014950) and m < 10^d * d/(d+1).

Examples

			13 is a term because the concatenation of 13, 12, ..., 5 is a 13-digit number.
100 is not a term because the concatenation of 100, 99, ..., 52 is a 99-digit number and concatenating this number with 51 yields a 101-digit number.
		

Crossrefs

Cf. A375461 (self-consecutive).

Programs

  • Mathematica
    SelfDownwardConsecutiveQ[n_] :=
     Module[{len = Length@IntegerDigits[n], num, c = 1, numDigits = 0},
      numDigits = len*Ceiling[n + 1 - 10^(len - 1)];
    If[numDigits >= n, Return[Mod[n, len] == 0]];
    num = n - Ceiling[n + 1 - 10^(len - 1)];
    While[numDigits < n + 1,
      If[(len - c)*Ceiling[num + 1 - 10^(len - c - 1)] >= n - numDigits,
       Return[Mod[n - numDigits, len - c] == 0],
       numDigits += (len - c)*Ceiling[num + 1 - 10^(len - c - 1)]
        ];
      num -= Ceiling[num + 1 - 10^(len - c - 1)];
      c++;
       ]
     ]
    Select[Range[1000], SelfDownwardConsecutiveQ]