OFFSET
1,2
COMMENTS
Kaprekar numbers (A006886) all of whose digits are equal. - N. J. A. Sloane, Mar 26 2025
The only numbers where the repeated digit and the number of digits are the same are 1, 88888888 and 999999999.
Conjectures from Daniel Mondot, Mar 28 2025: (Start)
The sequence a(n)%10 (i.e. the last (or any) digit of a(n)), is 15-periodic. the sequence would be : 1,9,5,9,9,7,9,2,9,9,4,9,8,9,9, repeating.
For n>15, a(n) can be constructed from a(n-15) by concatenating to it 9 times a digit of a(n-15). (End)
The above two conjectures are linked, they are easily proved using modular arithmetic, and correspond to the explicit formula given below. - M. F. Hasler, Mar 28 2025
LINKS
Daniel Mondot, Table of n, a(n) for n = 1..1000
Shyam Sunder Gupta, On Some Marvellous Numbers of Kaprekar, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 9, 275-315. See Sections 9.2.2 and 9.2.3.
Robert P. Munafo, Kaprekar sequences at MROB
FORMULA
a(n) = d(n) * R(floor(n*3/5+2/5)), where R(n) = (10^n-1)/9 = A002275(n) and d = (1, 9, 5, 9, 9; 7, 9, 2, 9, 9; 4, 9, 8, 9, 9) repeating, where ";" is used just to emphasize the 3 similar subgroups of length 5, with 2nd, 4th and 5th element equal to 9. - M. F. Hasler, Mar 28 2025
Length (= number of digits) of the n-th term is floor((n+2)*3/5). - M. F. Hasler, Mar 31 2025
PROG
apply( {A145875(n)=10^(n--*3\5+1)\9*if(bittest(5, n%5), [1, 5, 7, 2, 4, 8][n%15*2\/5+1], 9)}, [1..29]) \\ M. F. Hasler, Mar 28 2025
(PARI) isk(k) = my(d=digits(k^2), nb=#d); if (nb%2, d=concat(0, d); nb++); fromdigits(Vec(d, nb/2)) + fromdigits(vector(nb/2, i, d[nb/2+i])) == k;
lista(nn) = my(list=List()); for (i=1, nn, for (d=1, 9, my(x = fromdigits(vector(i, k, d))); if (isk(x), listput(list, x)); ); ); Vec(list); \\ Michel Marcus, Mar 29 2025
(Python)
def A145875(n): return (9, 1, 9, 5, 9, 9, 7, 9, 2, 9, 9, 4, 9, 8, 9)[n%15]*(10**((3*n+2)//5)-1)//9 # Chai Wah Wu, May 31 2026
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Howard Berman (howard_berman(AT)hotmail.com), Oct 22 2008
EXTENSIONS
More terms from Gupta (2025) added by N. J. A. Sloane, Mar 26 2025
STATUS
approved
