

A242541


Undulating primes: prime numbers whose digits follow the pattern A, B, A, B, A, B, A, B, ...


5



2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 18181, 32323, 35353, 72727, 74747, 78787, 94949, 95959, 1212121, 1616161, 323232323
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

All numbers in this sequence with three or more digits must have an odd number of digits. Any number with an even number of digits that follow this pattern is divisible by a number of the form 1010101...1010101 where the number of digits is one less than the number of digits in the original number.
Because A may equal B, 11 (and other prime repunits) are terms in this sequence (but not of A032758).  Harvey P. Dale, May 26 2015


LINKS



EXAMPLE

121 = 11*11 is not prime and thus is not a term of this sequence.


MAPLE

select(isprime, [$0..99, seq(seq(seq(a*(10^(d+1)10^(d+1 mod 2))/99 + b*(10^d  10^(d mod 2))/99, b=0..9), a=1..9, 2), d=3..9, 2)]); # Robert Israel, Jul 08 2016


MATHEMATICA

Select[Union[Flatten[Table[FromDigits[PadRight[{}, n, #]], {n, 9}]&/@ Tuples[ Range[0, 9], 2]]], PrimeQ] (* Harvey P. Dale, May 26 2015 *)


PROG

(Python)
from itertools import count, islice
from sympy import isprime, primerange
def agen(): # generator of terms
yield from primerange(2, 100)
yield from (t for t in (int((A+B)*d2+A) for d2 in count(1) for A in "1379" for B in "0123456789") if isprime(t))


CROSSREFS



KEYWORD

nonn,base


AUTHOR



STATUS

approved



