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.

A141274 Composite numbers k such that k+1 is prime and the index in the composites is also prime.

Original entry on oeis.org

12, 28, 36, 60, 100, 130, 138, 150, 172, 180, 198, 222, 270, 292, 348, 396, 420, 432, 456, 520, 540, 568, 612, 618, 640, 682, 732, 768, 786, 820, 838, 880, 928, 996, 1032, 1060, 1068, 1090, 1096, 1212, 1222, 1276, 1300, 1306, 1320, 1372, 1428, 1486, 1548
Offset: 1

Views

Author

Enoch Haga, Jun 21 2008

Keywords

Comments

Suggested by Carlos Rivera's Puzzle 449.

Examples

			a(1) = 12 because 12+1 = 13, prime and the index of 12 is 5, so both the composite 12+1 and the index are prime.
		

Crossrefs

Cf. A141275.

Programs

  • Mathematica
    Select[Range[4,1548],!PrimeQ[#]&&PrimeQ[#+1]&&PrimeQ[#-PrimePi[#]-2]&] (* James C. McMahon, Jul 19 2025 *)
  • Python
    from sympy import compositepi, isprime
    def ok(n):
        return not isprime(n) and isprime(n+1) and isprime(compositepi(n)-1)
    print([k for k in range(1549) if ok(k)]) # Michael S. Branicky, Dec 28 2021

Formula

Compute the composite numbers beginning with 4. At 4 the composite index is zero, at 6 it is 1, at 8 it is 2, ... and at 12 it is 5, etc.

Extensions

Edited by N. J. A. Sloane, Jun 21 2008