login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A082979
Lexicographically earliest rearrangement of primes such that the sum of two consecutive terms is a palindrome.
2
2, 3, 5, 17, 71, 131, 101, 151, 61, 181, 31, 13, 53, 149, 73, 139, 83, 179, 23, 43, 199, 457, 7, 37, 29, 59, 163, 79, 173, 89, 113, 109, 103, 311, 547, 271, 11, 191, 41, 47, 19, 193, 211, 223, 241, 233, 251, 557, 281, 577, 5869, 137, 277, 127, 307, 97, 317, 107
OFFSET
1,1
LINKS
MATHEMATICA
seq={2}; Do[k=3; While[MemberQ[seq, k] || !PalindromeQ[k+seq[[-1]]], k = NextPrime[k]]; AppendTo[seq, k], {i, 1, 50}]; seq (* Amiram Eldar, Dec 04 2018 *)
PROG
(PARI)
ispal(n)={my(v=digits(n)); for(i=1, #v\2, if(v[i]<>v[#v+1-i], return(0))); 1}
seq(n)={my(v=vector(n), M=Map(), t=0); for(n=1, n, forprime(p=1, oo, if(!mapisdefined(M, p) && ispal(p+t), t=p; break)); mapput(M, t, 1); v[n]=t); v} \\ Andrew Howroyd, Dec 04 2018
CROSSREFS
Sequence in context: A173236 A268209 A245641 * A065952 A308316 A089983
KEYWORD
base,nonn,look
AUTHOR
Jason Earls, May 28 2003
STATUS
approved