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

%I #16 Mar 26 2023 16:04:08

%S 1,2,4,8,11,13,14,22,26,28,44,52,56,77,88,91,137,146,274,292,548,584,

%T 9091,19802,39604,79208,909091,5882353,10989011,12987013,13986014,

%U 15037594,16194332,19138756,21978022,25974026,27972028,30075188,32388664,38277512,43956044

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

%H Michael S. Branicky, <a href="/A116443/b116443.txt">Table of n, a(n) for n = 1..6504</a>

%e 91 belongs since 8918 is a multiple of 91 (91*98 = 8918).

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

%t Select[Range[301*10^5],Divisible[FromDigits[Join[{8},IntegerDigits[#],{8}]],#]&] (* _Harvey P. Dale_, Aug 27 2019 *)

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o yield from [1, 2, 4, 8]

%o for k in count(2):

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

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

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

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

%K base,nonn

%O 1,2

%A _Giovanni Resta_, Feb 15 2006

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