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.

A285791 Primes equal to a heptagonal number plus 1.

Original entry on oeis.org

2, 19, 113, 149, 541, 617, 971, 1289, 1783, 2357, 3011, 3187, 5689, 6427, 7481, 7757, 9829, 12497, 12853, 14327, 15881, 17099, 18793, 21023, 24851, 28463, 30637, 31193, 45361, 50909, 54539, 60607, 63761, 66179, 69473, 70309, 83449, 88079, 90917, 91873, 94771
Offset: 1

Views

Author

Colin Barker, Apr 26 2017

Keywords

Crossrefs

Programs

  • PARI
    pg(m, n) = (n^2*(m-2)-n*(m-4))/2 \\ n-th m-gonal number
    maxk=300; L=List(); for(k=1, maxk, if(isprime(p=pg(7, k) + 1), listput(L, p))); Vec(L)
    
  • Python
    from sympy import isprime
    def heptagonal(n): return n*(5*n-3)//2
    def aupto(limit):
      alst, n, hn = [], 1, heptagonal(1)
      while hn < limit:
        if isprime(hn+1): alst.append(hn+1)
        n, hn = n+1, heptagonal(n+1)
      return alst
    print(aupto(94771)) # Michael S. Branicky, Feb 19 2021