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.

A330310 Let p = prime(n); a(n) = (p-1)/2 if that is prime, or (p+1)/2 if that is prime, and otherwise p itself.

Original entry on oeis.org

2, 2, 2, 3, 5, 7, 17, 19, 11, 29, 31, 19, 41, 43, 23, 53, 29, 31, 67, 71, 37, 79, 41, 89, 97, 101, 103, 53, 109, 113, 127, 131, 137, 139, 149, 151, 79, 163, 83, 173, 89, 181, 191, 97, 197, 199, 211, 223, 113, 229, 233, 239, 241, 251, 257, 131, 269, 271, 139
Offset: 1

Views

Author

N. J. A. Sloane, Dec 10 2019

Keywords

Crossrefs

Suggested by A328686.

Programs

  • Maple
    a:=[2];
    for n from 2 to 80 do p:=ithprime(n);
    if isprime((p-1)/2) then t:=(p-1)/2; elif isprime((p+1)/2) then t:=(p+1)/2 else t:=p; fi;
    a:=[op(a),t];
    od: a;
  • PARI
    a(n) = { my (p=prime(n), q); if (p%2, if (isprime(q=(p-1)/2), return (q), isprime(q=(p+1)/2), return (q))); return (p) } \\ Rémy Sigrist, Dec 11 2019