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.

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

This page as a plain text file.
%I A029479 #32 Jan 22 2024 06:06:27
%S A029479 1,3,9,19,27,41,103,147,189,441,567,711,6759,15353,24441,59823,209903,
%T A029479 1430217,2848851,2969973,13358067,146247471,289542573,1891846557,
%U A029479 2388085659,4489093899,5345125899,5455876131,9843149241
%N A029479 Numbers k that divide the (left) concatenation of all numbers <= k written in base 10 (most significant digit on left).
%C A029479 No other terms below 10^10.
%H A029479 <a href="/index/N#concat">Index entries for related sequences</a>
%e A029479 19 is a term since 19181716151413121110987654321 is divisible by 19.
%t A029479 b = 10; c = {}; Select[Range[10^4], Divisible[FromDigits[c = Join[IntegerDigits[#, b], c], b], #] &] (* _Robert Price_, Mar 12 2020 *)
%t A029479 Select[Range[134*10^5],Divisible[FromDigits[Flatten[IntegerDigits/@Range[#,1,-1]]],#]&] (* _Harvey P. Dale_, Oct 09 2022 *)
%o A029479 (Python)
%o A029479 def concat_mod(base, k, mod):
%o A029479   total, offset, digits, n1 = 0, 0, 1, 1
%o A029479   while n1 <= k:
%o A029479     n2, p = min(n1*base-1, k), n1*base
%o A029479     # Compute ((p-1)*n2-1)*p**(n2-n1+1)-(n1-1)*p+n1 divided by (p-1)**2.
%o A029479     # Since (a//b)%mod == (a%(b*mod))//b, compute the numerator mod (p-1)**2*mod.
%o A029479     tmp = pow(p,n2-n1+1,(p-1)**2*mod)
%o A029479     tmp = ((p-1)*n2-1)*tmp-(n1-1)*p+n1
%o A029479     tmp = (tmp%((p-1)**2*mod))//(p-1)**2
%o A029479     total += tmp*pow(base,offset,mod)
%o A029479     offset, digits, n1 = offset+digits*(n2-n1+1), digits+1, p
%o A029479   return total%mod
%o A029479 for k in range(1,10**10):
%o A029479   if concat_mod(10, k, k) == 0: print(k) # _Jason Yuen_, Jan 14 2024
%Y A029479 Cf. A029447-A029470, A029471-A029494, A029495-A029518, A029519-A029542, A061931-A061954, A061955-A061978.
%K A029479 nonn,base,more
%O A029479 1,2
%A A029479 _Olivier Gérard_
%E A029479 6759 from Andrew Gacek (andrew(AT)dgi.net), Feb 20 2000
%E A029479 More terms from Larry Reeves (larryr(AT)acm.org), May 24 2001
%E A029479 Edited and updated by Larry Reeves (larryr(AT)acm.org), Apr 12 2002
%E A029479 a(18)-a(21) from _Max Alekseyev_, May 15 2011
%E A029479 a(22)-a(29) from _Jason Yuen_, Jan 14 2024