|
|
A153332
|
|
Numbers k such that (10^k - 1)*150/99 + 1 is prime.
|
|
0
|
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
These numbers are always even. If k is odd, then 10^k - 1 produces a number with an odd number of 9's which 99 does not divide. Also the numbers produced by this formula are palindromic.
|
|
LINKS
|
|
|
EXAMPLE
|
For the first entry, k=2, the formula produces the prime 151.
|
|
MATHEMATICA
|
2*Floor[IntegerLength[#]/2]&/@Select[Table[FromDigits[Join[{1}, PadRight[ {}, 2n, {5, 1}]]], {n, 1000}], PrimeQ] (* Harvey P. Dale, Jun 27 2012 *)
|
|
PROG
|
(PARI) /* n=number of values to test, r=repeat digits, e.g., 14, 121, 177, 1234, etc.
d = last digit appended to the end */
repr(n, r, d) = ln=length(Str(r)); for(x=0, n, y=(10^(ln*x)-1)*10*r/(10^ln-1)+1; if(ispseudoprime(y), print1(ln*x", ")))
(Python)
from sympy import isprime
def afind(limit, startk=2):
k = startk + (startk%2)
t = int("1" + "51"*(k//2))
for k in range(startk, limit+1, 2):
if isprime(t): print(k, end=", ")
t *= 100
t += 51
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,hard,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|