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!)
A343675 Undulating alternating palindromic primes. 3

%I #18 Apr 26 2021 21:26:10

%S 2,3,5,7,101,181,383,727,787,929,10301,10501,14341,16361,16561,18181,

%T 30103,30703,32323,36563,38183,38783,70507,72727,74747,78787,90709,

%U 94949,96769,1074701,1092901,1212121,1218121,1412141,1616161,1658561,1856581,1878781,3072703

%N Undulating alternating palindromic primes.

%C All terms have an odd number of decimal digits.

%C For n > 3, a(n) is odd and not divisible by 5.

%C Intersection of A002385, A030144 and A059168.

%C Subsequence of A343590.

%H Chai Wah Wu, <a href="/A343675/b343675.txt">Table of n, a(n) for n = 1..10000</a>

%e 16361 is a term as it is a palindromic prime, the digits 1, 6, 3, 6 and 1 have odd and even parity alternately, and also alternately rise and fall.

%t Union@Flatten[{{2,3,5,7},Array[Select[FromDigits/@Riffle@@@Tuples[{Tuples[{1,3,5,7,9},#],Tuples[{0,2,4,6,8},#-1]}],(s=Union@Partition[Sign@Differences@IntegerDigits@#,2];(s=={{1,-1}}||s=={{-1,1}})&&PrimeQ@#&&PalindromeQ@#)&]&,4]}] (* _Giorgos Kalogeropoulos_, Apr 26 2021 *)

%o (Python)

%o from sympy import isprime

%o def f(w):

%o for s in w:

%o for t in range(int(s[-1])+1,10,2):

%o yield s+str(t)

%o def g(w):

%o for s in w:

%o for t in range(1-int(s[-1])%2,int(s[-1]),2):

%o yield s+str(t)

%o A343675_list = [2,3,5,7]

%o for l in range(1,9):

%o for d in '1379':

%o x = d

%o for i in range(1,l+1):

%o x = g(x) if i % 2 else f(x)

%o A343675_list.extend([int(p+p[-2::-1]) for p in x if isprime(int(p+p[-2::-1]))])

%o y = d

%o for i in range(1,l+1):

%o y = f(y) if i % 2 else g(y)

%o A343675_list.extend([int(p+p[-2::-1]) for p in y if isprime(int(p+p[-2::-1]))])

%Y Cf. A002385, A030144, A059168, A343590.

%K nonn,base

%O 1,1

%A _Chai Wah Wu_, Apr 25 2021

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 19 05:19 EDT 2024. Contains 371782 sequences. (Running on oeis4.)