login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A268706 Largest n-digit prime having at least n-1 digits equal to 7. 3

%I #12 Mar 12 2016 22:51:16

%S 7,97,977,7877,97777,787777,7877777,77777747,787777777,8777777777,

%T 79777777777,777777779777,7877777777777,77777779777777,

%U 778777777777777,8777777777777777,77797777777777777,797777777777777777,7777877777777777777,97777777777777777777

%N Largest n-digit prime having at least n-1 digits equal to 7.

%H Michel Lagneau, Michael De Vlieger and Robert G. Wilson v, <a href="/A268706/b268706.txt">Table of n, a(n) for n = 1..1268</a>

%p f:= proc(n)

%p local r,i,j,p;

%p r:= 7*(10^n-1)/9;

%p for p in sort([r, seq(seq(r + i*10^j, i=[$(-7)..(-1),1,2]),j=0..n-1)],`>`) do

%p if isprime(p) then return p fi

%p od;

%p error("no prime found")

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Feb 24 2016

%t f[n_] := Block[{k = 0, p = {}, r = 7 (10^n - 1)/9, s = Range@ 10 - 8}, While[k < n, AppendTo[p, Select[r + 10^k*s, PrimeQ]]; k++]; p = Max@ Flatten@ p]; Array[f, 20]

%Y Cf. A241100, A268702, A268703, A268704, A268705, A268707, A241206, A266146.

%K nonn,base

%O 1,1

%A _Michel Lagneau_, _Michael De Vlieger_ and _Robert G. Wilson v_, Feb 11 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)