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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A068876 Smallest n-digit prime with property that digits alternate in parity. 7
2, 23, 101, 2129, 10103, 210101, 1010129, 21010127, 101010167, 2101010147, 10101010163, 210101010187, 1010101010341, 21010101010147, 101010101010323, 2101010101010141, 10101010101010141, 210101010101010323, 1010101010101010143 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Table of n, a(n) for n=1..19.

EXAMPLE

a(4) = 2129 as 2, 1, 2 and 9 have even and odd parity alternately.

MATHEMATICA

fQ[n_] := Block[{m = Mod[ IntegerDigits@ n, 2]}, m == Split[m, UnsameQ][[1]]]; f[n_] := Block[{c = 1 + 100 (100^Ceiling[n/2 - 1] - 1)/99, k}, k = If[ OddQ@ n, c, 2*10^(n - 1) + c]; k = NextPrime[k - 1]; While[ !fQ@ k, k = NextPrime@ k]; k]; Array[f, 21] (* Robert G. Wilson v, Apr 01 2011 *)

PROG

(Sage)

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

def A068876(n):

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

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

........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, A068877.

Sequence in context: A053999 A131176 A141405 * A073175 A141888 A285811

Adjacent sequences:  A068873 A068874 A068875 * A068877 A068878 A068879

KEYWORD

nonn,base

AUTHOR

Amarnath Murthy, Mar 19 2002

EXTENSIONS

a(9)-a(13) corrected and a(14)-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 February 22 05:58 EST 2018. Contains 299430 sequences. (Running on oeis4.)