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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A068877 Largest n-digit prime with property that digits alternate in parity. 2
7, 89, 983, 8969, 98981, 898987, 9898921, 89898983, 989898989, 8989898969, 98989898981, 898989898987, 9898989898901, 89898989898967, 989898989898943, 8989898989898969, 98989898989898981, 898989898989898943, 9898989898989898789 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Giovanni Resta, Table of n, a(n) for n = 1..500

EXAMPLE

a(4) = 8969 as 8, 9, 6 and 9 have even and odd parity alternately.

PROG

(Sage)

concat = lambda x: Integer(''.join(map(str, x)), base=10)

def A068877(n):

....dd = {0:range(0, 10, 2)[::-1], 1: range(1, 10, 2)[::-1]}

....for d0 in [1..9][::-1]:

........if n % 2 == 0 and d0 % 2 == 1: continue # optimization

........ds = [dd[(d0+1+i) % 2] for i in range(n-1)]

........for dr in CartesianProduct(*ds):

............c = concat([d0]+dr)

............if is_prime(c): return c  # [D. S. McNeil, Apr 02 2011]

CROSSREFS

Cf. A030144, A068876.

Sequence in context: A068692 A178006 A053302 * A121044 A107109 A089771

Adjacent sequences:  A068874 A068875 A068876 * A068878 A068879 A068880

KEYWORD

nonn,base

AUTHOR

Amarnath Murthy, Mar 19 2002

EXTENSIONS

a(15)-a(19) from Donovan Johnson, Apr 01 2011

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 17 05:23 EDT 2018. Contains 316275 sequences. (Running on oeis4.)