A059758 Undulating palindromic primes: numbers that are prime, palindromic in base 10, and the digits alternate: ababab... with a != b.
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, 383838383, 727272727, 919191919, 929292929, 979797979, 989898989
Offset: 1
References
- C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.
- C. W. Trigg, Palindromic Octagonal Numbers, Journal of Recreational Mathematics, 15:1, pp. 41-46, 1982-83.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..100
- P. De Geest, More undulating primes
- R. Ondrejka, The Top Ten: a Catalogue of Primal Configurations
- C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," Zentralblatt review
Crossrefs
Cf. A032758.
Programs
-
Maple
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 Sellers, Feb 13 2001
-
Mathematica
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 *) 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 *)
-
Python
from sympy import isprime A059758_list = [] for l in range(1,300): for a in '1379': for b in '0123456789': if a != b: p = int((a+b)*l+a) if isprime(p): A059758_list.append(p) # Chai Wah Wu, Dec 21 2014
Extensions
More terms from James Sellers, Feb 13 2001