login
Numbers k that divide the (right) concatenation of all numbers <= k written in base 10 (most significant digit on left).
9

%I #50 Feb 24 2024 14:59:38

%S 1,2,3,5,6,9,10,12,15,18,20,25,27,30,36,45,50,54,60,69,75,90,100,108,

%T 120,125,135,150,162,180,200,216,225,248,250,270,300,324,360,375,405,

%U 450,470,500,540,558,600,648,675,710,750,810,900,1000,1053,1080,1116

%N Numbers k that divide the (right) concatenation of all numbers <= k written in base 10 (most significant digit on left).

%C Numbers k such that k divides A007908(k).

%H Jason Yuen, <a href="/A029455/b029455.txt">Table of n, a(n) for n = 1..1195</a> (terms 1..236 from M. F. Hasler, terms 237..637 from Chai Wah Wu)

%e k = 13 is not a term since 12345678910111213 is not divisible by 13.

%t b = 10; c = {}; Select[Range[10^5], Divisible[FromDigits[c = Join[c, IntegerDigits[#, b]], b], #] &] (* _Robert Price_, Mar 11 2020 *)

%t Select[Range[1200],Divisible[FromDigits[Flatten[IntegerDigits/@Range[#]]],#]&] (* _Harvey P. Dale_, Dec 31 2020 *)

%t 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 *)

%o (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

%o (Python)

%o A029455_list, r = [], 0

%o for n in range(1,10**4+1):

%o r = r*10**len(str(n))+n

%o if not (r % n):

%o A029455_list.append(n) # _Chai Wah Wu_, Nov 05 2014

%o (Python)

%o def concat_mod(base, k, mod):

%o total, digits, n1 = 0, 1, 1

%o while n1 <= k:

%o n2, p = min(n1*base-1, k), n1*base

%o # Compute ((p-1)*n1+1)*p**(n2-n1+1)-(n2+1)*p+n2 divided by (p-1)**2.

%o # Since (a//b)%mod == (a%(b*mod))//b, compute the numerator mod (p-1)**2*mod.

%o tmp = pow(p, n2-n1+1, (p-1)**2*mod)

%o tmp = ((p-1)*n1+1)*tmp-(n2+1)*p+n2

%o tmp = (tmp%((p-1)**2*mod))//(p-1)**2

%o total = (total*pow(p, n2-n1+1, mod)+tmp)%mod

%o digits, n1 = digits+1, p

%o return total

%o for k in range(1, 10**10+1):

%o if concat_mod(10, k, k) == 0: print(k) # _Jason Yuen_, Jan 27 2024

%Y Cf. A029447-A029470, A029471-A029494, A029495-A029518, A029519-A029542, A061931-A061954, A061955-A061978, A332580.

%Y See A171785 for numbers that divide the concatenation of a(1) through a(n).

%K nonn,base

%O 1,2

%A _Olivier GĂ©rard_