login
Numbers k which when sandwiched between two 5's give a multiple of k.
9

%I #19 Mar 26 2023 11:15:02

%S 1,5,11,13,35,55,65,77,91,137,365,685,9091,49505,909091,5882353,

%T 10989011,12987013,20242915,23923445,34965035,37593985,52631579,

%U 54945055,64935065,76923077,90909091,495049505,1976284585,4132231405,4347826087,9090909091,13698630137

%N Numbers k which when sandwiched between two 5's give a multiple of k.

%C All terms must be odd. - _Harvey P. Dale_, Jul 29 2015

%H Michael S. Branicky, <a href="/A116440/b116440.txt">Table of n, a(n) for n = 1..3294</a>

%e 137 belongs since 51375 is a multiple 137 (137*375).

%p a:=proc(n) local nn: nn:=convert(n,base,10): if type((5+10*n+5*10^(nops(nn)+1))/n, integer)=true then n else fi end: seq(a(n),n=1..10000); # _Emeric Deutsch_, Feb 28 2006

%t f[k_, d_] := Flatten@Table[Select[Divisors[k*(10^(i + 1) + 1)], IntegerLength[ # ] == i &], {i, d}]; f[5, 10] (* _Ray Chandler_, May 11 2007 *)

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o yield from [1, 5]

%o for k in count(2):

%o t = 5*(10**(k+1) + 1)

%o yield from (t//i for i in range(500, 50, -1) if t%i == 0)

%o print(list(islice(agen(), 33))) # _Michael S. Branicky_, Mar 26 2023

%Y Cf. A116436, A116437, A116438, A116439, A116441, A116442, A116443, A116444.

%K base,nonn

%O 1,2

%A _Giovanni Resta_, Feb 15 2006

%E a(31) and beyond from _Michael S. Branicky_, Mar 26 2023