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.

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

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Numbers k such that k divides A007908(k).

Examples

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

Crossrefs

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

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