%I #30 Aug 11 2024 14:41:33
%S 101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,18181,
%T 32323,35353,72727,74747,78787,94949,95959,1212121,1616161,323232323,
%U 383838383,727272727,919191919,929292929,979797979,989898989
%N Undulating palindromic primes: numbers that are prime, palindromic in base 10, and the digits alternate: ababab... with a != b.
%D C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.
%D C. W. Trigg, Palindromic Octagonal Numbers, Journal of Recreational Mathematics, 15:1, pp. 41-46, 1982-83.
%H Harvey P. Dale, <a href="/A059758/b059758.txt">Table of n, a(n) for n = 1..100</a>
%H P. De Geest, <a href="https://www.worldofnumbers.com/undulat.htm">More undulating primes</a>
%H R. Ondrejka, <a href="http://www.utm.edu/research/primes/lists/top_ten/">The Top Ten: a Catalogue of Primal Configurations</a>
%H C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," <a href="http://www.zentralblatt-math.org/zmath/en/search/?q=an:0983.00008&format=complete">Zentralblatt review</a>
%p for l from 3 to 31 by 2 do for i from 0 to 9 do for j from 0 to 9 do it1 := sum(i*10^(2*k), k=0..(l-1)/2): it2 := sum(j*10^(2*k+1), k=0..(l-3)/2): if isprime(it1+it2) and i<>j then printf(`%d, `,it1+it2) fi: od: od: od: # _James A. Sellers_, Feb 13 2001
%t t = {}; t1 = {1, 3, 7, 9}; Do[p = 10 a + b; q = 10 b + a; t = Join[t, Select[Table[(p*10^(2 n + 1) - q)/99, {n, 4}], PrimeQ]], {a, t1}, {b, Range[0, 9]}]; Union[t] (* _Jayanta Basu_, Jun 23 2013 *)
%t uppQ[n_]:=Module[{idn=IntegerDigits[n]},OddQ[Length[idn]]&& PalindromeQ[ n] && Length[Union[Partition[idn,2]]]==1]; Select[Prime[Range[ 51*10^6]], uppQ] (* or *) Select[FromDigits/@Flatten[Table[Riffle[Table[n,i],k],{n,{1,3,7,9}},{i,5},{k,0,9}],2],#>9&&PrimeQ[#]&]//Sort (* The second program is significantly faster than the first. *) (* _Harvey P. Dale_, Feb 24 2018 *)
%o (Python)
%o from sympy import isprime
%o A059758_list = []
%o for l in range(1,300):
%o for a in '1379':
%o for b in '0123456789':
%o if a != b:
%o p = int((a+b)*l+a)
%o if isprime(p):
%o A059758_list.append(p) # _Chai Wah Wu_, Dec 21 2014
%Y Cf. A032758.
%K nonn,easy,base
%O 1,1
%A _Jeff Heleen_, Feb 11 2001
%E More terms from _James A. Sellers_, Feb 13 2001