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.

A308829 Numbers k such that 3^k - k + 1 is prime.

Original entry on oeis.org

0, 1, 5, 27, 45, 47, 75, 8895, 11405, 29517, 84615, 218307
Offset: 1

Views

Author

Giuseppe Bonaccorso, Aug 02 2019

Keywords

Comments

Sieving can be limited to odd values of k, because 3^k - k + 1 is even when k is even. In fact, if k is even, 3^k - k is odd and the successor is even.

Crossrefs

Programs

  • Mathematica
    ListA[k_] := Block[{seq = {}, n = 0, i = 0}, While[Length[seq] < k, {n = 3^i - i + 1, If[PrimeQ[n], AppendTo[seq, i]], i += 1}]; seq]
  • PARI
    isok(k) = isprime(3^k - k + 1); \\ Jinyuan Wang, Aug 03 2019
  • Sage
    def list_a(k):
      return [i for i in range(k) if (3**i) - i + 1 in Primes()]