login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A241206 Greatest n-digit prime having at least n-1 identical digits. 7
7, 97, 997, 9949, 99991, 999979, 9999991, 99999989, 999999929, 9999999929, 99999999599, 999999999989, 9999999999799, 99999999999959, 999999999999989, 9999999999999199, 99999999999999997, 999999999999999989, 9999999999999999919, 99999999999999999989 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Not the same as A069661 (Smallest n-digit prime with maximum digit sum). For example, A069661(10) = 9899989999 with only n-2 = 8 identical digits.

Conjecture: each term consists of at least n-1 digits 9 and no digit 0. - Chai Wah Wu, Dec 10 2015

LINKS

Chai Wah Wu, Table of n, a(n) for n = 1..1000 (corrected by Georg Fischer, Jan 20 2019)

MAPLE

with(numtheory):lst:={}:nn:=30:kk:=0:T:=array(1..nn):U:=array(1..20):

   for n from 2 to nn do:

     for i from 1 to n do:

     T[i]:=9:

     od:

     ii:=0:

        for j from 1 to n while(ii=0)do:

        for k from 9 by -1 to 0 while(ii=0)do:

        T[n-j+1]:=k:s:=sum('T[i]*10^(n-i)', 'i'=1..n):

         if type(s, prime)=true and length(s)=n

         then

         ii:=1: kk:=kk+1:U[kk]:=s:

         else

         T[n-j+1]:=9:

         fi:

       od:

     od:

    od :

     print(U) :

MATHEMATICA

Table[SelectFirst[Reverse@ Prime@ Range[PrimePi[10^(n - 1)] + 1, PrimePi[10^n - 1]], Max@ DigitCount@ # >= (n - 1) &], {n, 2, 8}]

(* WARNING: the following assumes the conjecture is true WARNING *)

Table[SelectFirst[Select[Reverse@ Union@ Map[FromDigits, Join @@ Map[Permutations[Append[Table[9, {n - 1}], #]] &, Range[0, 9]]], PrimeQ@ # && IntegerLength@ # == n &], Max@ DigitCount@ # >= (n - 1) &], {n, 2, 20}] (* Michael De Vlieger, Dec 10 2015, Version 10 *)

PROG

(Python)

from __future__ import division

from sympy import isprime

def A241206(n):

    for i in range(9, 0, -1):

        x = i*(10**n-1)//9

        for j in range(n-1, -1, -1):

            for k in range(9-i, -1, -1):

                y = x + k*(10**j)

                if isprime(y):

                    return y

        for j in range(n):

            for k in range(1, i+1):

                if j < n-1 or k < i:

                    y = x-k*(10**j)

                    if isprime(y):

                        return y # Chai Wah Wu, Dec 29 2015

CROSSREFS

Cf. A069661, A241100.

Sequence in context: A146758 A114019 A178007 * A127892 A125590 A068694

Adjacent sequences:  A241203 A241204 A241205 * A241207 A241208 A241209

KEYWORD

nonn,base

AUTHOR

Michel Lagneau, Apr 17 2014

EXTENSIONS

a(1) added - N. J. A. Sloane, Dec 29 2015

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 January 19 18:13 EST 2020. Contains 331051 sequences. (Running on oeis4.)