login
A087605
Smallest k such that n times concatenation of k with itself followed by a 7 is a prime, or 0 if no such number exists.
7
1, 2, 1, 1, 3, 100005, 1, 2, 4, 6, 8, 100010, 19, 2, 215, 9, 60, 100041, 4, 66, 5, 1, 41, 100061, 4, 15, 2, 1, 195, 100055, 61, 1061, 143, 12, 72, 100127, 19, 60, 1, 6, 125, 0, 45, 1305, 3, 39, 27, 100269, 72, 95, 136, 1123, 50, 100193, 52, 1056, 176, 1536, 66
OFFSET
1,2
COMMENTS
a(42n)=0, but all other terms are probably nonzero. For n a multiple of 42, (10^(l*n)-1)/(10^l-1)*10+7 is divisible by 7 for any l. - Max Alekseyev, Feb 11 2005
FORMULA
Minimal k such that k*(10^(l*n)-1)/(10^l-1)*10+7 is prime, where l is the length of k; and 0 if no such prime exists. - Max Alekseyev, Feb 11 2005
EXAMPLE
a(5) = 3 as 333337 is a prime but 111117 and 222227 are not.
PROG
(PARI) { a(n) = if(n%42==0, return(0)); for(l=1, 10^6, if(valuation(10^(l*n)-1, 7)==valuation(10^l-1, 7), for(k=10^(l-1), 10^l-1, if(isprime(k*(10^(l*n)-1)/(10^l-1)*10+7), return(k) ) ) ) ) } (Alekseyev)
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Sep 18 2003
EXTENSIONS
Corrected and extended by Max Alekseyev, Feb 11 2005
STATUS
approved