login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A178000 Largest n-digit prime with the maximum number of digits equal to 2. 2
2, 29, 229, 2221, 22229, 922223, 9222229, 22222223, 222222227, 7222222229, 22222222223, 522222222229, 9222222222229, 22222222222229, 222222222222227, 9222222222222227, 72222222222222221, 222222222222222221 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Select first for most 2's, then take the largest.

In more detail: To get a(n), look at the list of all the n-digit primes. Suppose k is the maximum number of 2's of any number on the list. Throw out any prime on the list that does not contain k 2's. Then a(n) = maximal number that is left on the list. - N. J. A. Sloane, Mar 20 2018

For n <= 1000, a(n) has at most two non-2's.  What is the first n for which it has more than two? - Robert Israel, Mar 20 2018

LINKS

Robert Israel, Table of n, a(n) for n = 1..999

MAPLE

# This program will return FAIL if a(n) has more than two digits <> 2.

f:= proc(n)

   local k1, d2, k2, t;

   for k1 in [9, 7, 3, 1] do if isprime(2/9*(10^n-1)+k1-2) then return 2/9*(10^n-1)+k1-2 fi od;

   for d2 from n to 2 by -1 do

     for k2 in [9, 8, 7, 6, 5, 4, 3] do

       for k1 in [9, 7, 3, 1] do

         t:= 2/9*(10^(n)-1)+(k2-2)*10^(d2-1) + k1-2;

         if isprime(t) then return t fi;

  od od od:

  FAIL

end proc:

f(1):= 2:

seq(f(n), n=1..30); # Robert Israel, Mar 20 2018

CROSSREFS

Cf. A037057, A099656, A177999.

Sequence in context: A244599 A261268 A020460 * A036939 A124301 A276196

Adjacent sequences:  A177997 A177998 A177999 * A178001 A178002 A178003

KEYWORD

nonn,base

AUTHOR

Lekraj Beedassy, May 17 2010

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 24 16:21 EDT 2019. Contains 326295 sequences. (Running on oeis4.)