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.

A128049 Least number k>0 such that abs((3^k - (3-n)^k)/n) is prime, or 0 if no such prime exists.

Original entry on oeis.org

0, 2, 3, 2, 2, 3, 0, 3, 2, 2, 3, 2, 0, 2, 3, 0, 3, 2, 0, 2, 37, 0, 3, 2, 0, 2, 1153, 0, 83, 2, 0, 3, 11, 0, 3, 2, 0, 2, 3, 0, 557, 19, 0, 2, 3, 0, 7, 2, 0, 2, 631, 0, 5, 2, 0, 3, 3, 0, 239, 2, 0, 5, 3, 0, 3, 2, 0, 2, 317, 0, 3, 103, 0, 2, 7, 0, 3, 2, 0, 2, 43
Offset: 0

Views

Author

Alexander Adamchuk, Feb 12 2007

Keywords

Comments

a(-n) = A128033(n).
a(3*n) = 0 except a(3) = a(9) = 2.
All positive terms are primes.

Crossrefs

Cf. A128033 (least number k>0 such that ((n+3)^k - 3^k)/n is prime), A028491 (numbers n such that (3^n - 1)/2 is prime).

Programs

  • PARI
    a(n) = my(p=3); if(isprime(abs(n-6)), 2, if(n%3, while(!ispseudoprime((3^p-(3-n)^p)/n), p=nextprime(p+1)); p, 0)); \\ Jinyuan Wang, Nov 28 2020

Extensions

Name changed by Jinyuan Wang, Nov 28 2020