login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A065581
Smallest prime ending in exactly n 7's.
6
7, 277, 1777, 47777, 2477777, 16777777, 137777777, 577777777, 1777777777, 67777777777, 377777777777, 16777777777777, 17777777777777, 577777777777777, 2777777777777777, 157777777777777777, 377777777777777777, 2777777777777777777, 97777777777777777777, 2477777777777777777777
OFFSET
1,1
LINKS
MATHEMATICA
Do[a = Table[7, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 7 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
k7[n_]:=Module[{c=FromDigits[PadRight[{}, n, 7]], k=0}, While[Nand[PrimeQ[k*10^n + c], Mod[k, 10] != 7], k++]; k*10^n+c]; Array[k7, 20] (* Harvey P. Dale, Jan 29 2013 *)
PROG
(PARI) a(n)={ my(t=10^n, b=7*(t-1)/9, d=0); while (!isprime(b + t*d), d++; if(d%10==7, d++)); b + t*d } \\ Harry J. Smith, Oct 23 2009
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Nov 28 2001
STATUS
approved