A029455 Numbers k that divide the (right) concatenation of all numbers <= k written in base 10 (most significant digit on left).
1, 2, 3, 5, 6, 9, 10, 12, 15, 18, 20, 25, 27, 30, 36, 45, 50, 54, 60, 69, 75, 90, 100, 108, 120, 125, 135, 150, 162, 180, 200, 216, 225, 248, 250, 270, 300, 324, 360, 375, 405, 450, 470, 500, 540, 558, 600, 648, 675, 710, 750, 810, 900, 1000, 1053, 1080, 1116
Offset: 1
Examples
k = 13 is not a term since 12345678910111213 is not divisible by 13.
Links
- Jason Yuen, Table of n, a(n) for n = 1..1195 (terms 1..236 from M. F. Hasler, terms 237..637 from Chai Wah Wu)
Crossrefs
Programs
-
Mathematica
b = 10; c = {}; Select[Range[10^5], Divisible[FromDigits[c = Join[c, IntegerDigits[#, b]], b], #] &] (* Robert Price, Mar 11 2020 *) Select[Range[1200],Divisible[FromDigits[Flatten[IntegerDigits/@Range[#]]],#]&] (* Harvey P. Dale, Dec 31 2020 *) nxt[{rc_,n_}]:={rc*10^IntegerLength[n+1]+n+1,n+1}; Select[NestList[nxt,{1,1},1200],Mod[#[[1]],#[[2]]]==0&][[;;,2]] (* Harvey P. Dale, Sep 26 2023 *)
-
PARI
c=0;for(d=1,1e9,for(n=d,-1+d*=10,(c=c*d+n)%n || print1(n","));d--) \\ M. F. Hasler, Sep 11 2011
-
Python
A029455_list, r = [], 0 for n in range(1,10**4+1): r = r*10**len(str(n))+n if not (r % n): A029455_list.append(n) # Chai Wah Wu, Nov 05 2014
-
Python
def concat_mod(base, k, mod): total, digits, n1 = 0, 1, 1 while n1 <= k: n2, p = min(n1*base-1, k), n1*base # Compute ((p-1)*n1+1)*p**(n2-n1+1)-(n2+1)*p+n2 divided by (p-1)**2. # Since (a//b)%mod == (a%(b*mod))//b, compute the numerator mod (p-1)**2*mod. tmp = pow(p, n2-n1+1, (p-1)**2*mod) tmp = ((p-1)*n1+1)*tmp-(n2+1)*p+n2 tmp = (tmp%((p-1)**2*mod))//(p-1)**2 total = (total*pow(p, n2-n1+1, mod)+tmp)%mod digits, n1 = digits+1, p return total for k in range(1, 10**10+1): if concat_mod(10, k, k) == 0: print(k) # Jason Yuen, Jan 27 2024
Comments