login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A242541 Undulating primes: prime numbers whose digits follow the pattern A, B, A, B, A, B, A, B, ... 5

%I #33 Jun 09 2022 20:10:45

%S 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

%T 97,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,18181,

%U 32323,35353,72727,74747,78787,94949,95959,1212121,1616161,323232323

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

%C 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.

%C Union of A004022 and A032758. - _Arkadiusz Wesolowski_, May 17 2014

%C 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

%H Harvey P. Dale, <a href="/A242541/b242541.txt">Table of n, a(n) for n = 1..135</a>

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

%p 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

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

%o (Python)

%o from itertools import count, islice

%o from sympy import isprime, primerange

%o def agen(): # generator of terms

%o yield from primerange(2, 100)

%o 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))

%o print(list(islice(agen(), 51))) # _Michael S. Branicky_, Jun 09 2022

%Y Cf. A004022, A032758, A033619.

%K nonn,base

%O 1,1

%A _J. Lowell_, May 17 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 07:53 EDT 2024. Contains 371964 sequences. (Running on oeis4.)