cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A082979 Lexicographically earliest rearrangement of primes such that the sum of two consecutive terms is a palindrome.

Original entry on oeis.org

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

Views

Author

Jason Earls, May 28 2003

Keywords

Programs

  • 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 *)
  • 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