login
A371895
a(n) is the least k>0 such that n*k contains the n-th prime as a substring.
1
2, 15, 5, 18, 22, 22, 25, 24, 26, 29, 21, 31, 32, 31, 98, 96, 27, 34, 88, 355, 13, 36, 21, 79, 39, 39, 189, 383, 376, 371, 41, 41, 416, 41, 426, 42, 425, 43, 43, 433, 419, 431, 237, 44, 266, 433, 45, 465, 464, 458, 83, 46, 423, 417, 468, 47, 472, 468, 47, 469, 103, 473, 488, 486, 202, 481, 348, 496, 63, 499
OFFSET
1,1
COMMENTS
From Robert Israel, Jun 06 2024: (Start)
If n is divisible by 2*10^k or 5*10^k, a(n) >= prime(n)*10^(k+1)/n.
Let n = 2^b * 5^c * k with k coprime to 10, and suppose prime(n) has d digits. If b <= c, then f(n) < 10^d * 2^(c-b). If b > c, then f(n) < 10^d * 5^(b-c).
a(10^k) = prime(10^k).
a(2*10^k) = 5 * prime(2*10^k).
a(5*10^k) = 2 * prime(5*10^k). (End)
LINKS
EXAMPLE
a(8) = 24 because 24 is the least positive integer such that 24*8 = 192 contains the prime(8) = 19.
MAPLE
f:= proc(n) local t, k;
t:= convert(ithprime(n), string);
for k from 1 do
if StringTools:-Search(t, convert(n*k, string)) > 0 then return k fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Jun 05 2024
MATHEMATICA
a[n_]:=(k=1; While[!StringContainsQ[ToString[n*k], ToString@Prime@n], k++]; k); Array[a, 70]
PROG
(Python)
from sympy import prime
from itertools import count
def a(n): t=str(prime(n)); return next(k for k in count(1) if t in str(n*k))
print([a(n) for n in range(1, 71)]) # Michael S. Branicky, Apr 11 2024
(Python) # faster for initial segment of sequence
from sympy import nextprime
from itertools import count, islice
def agen(): # generator of terms
pn = 2
for n in count(1):
t = str(pn)
yield next(k for k in count(1) if t in str(n*k))
pn = nextprime(pn)
print(list(islice(agen(), 70))) # Michael S. Branicky, Apr 11 2024
(PARI) a(n) = my(k=1, s=Str(prime(n))); while(#strsplit(Str(k*n), s) < 2, k++); k; \\ Michel Marcus, Apr 11 2024
CROSSREFS
Sequence in context: A266584 A372974 A104773 * A371340 A363483 A128759
KEYWORD
nonn,base,look
AUTHOR
STATUS
approved