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.

A005381 Numbers k such that k and k-1 are composite.

Original entry on oeis.org

9, 10, 15, 16, 21, 22, 25, 26, 27, 28, 33, 34, 35, 36, 39, 40, 45, 46, 49, 50, 51, 52, 55, 56, 57, 58, 63, 64, 65, 66, 69, 70, 75, 76, 77, 78, 81, 82, 85, 86, 87, 88, 91, 92, 93, 94, 95, 96, 99, 100, 105, 106, 111, 112, 115, 116, 117, 118, 119, 120, 121, 122
Offset: 1

Views

Author

Keywords

Comments

Position where the composites first outnumber the primes by n, among the first natural numbers. - Lekraj Beedassy, Jul 11 2006

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 844.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Equals A068780 + 1. Cf. A007921.
Cf. A093515 (complement, apart from 1 which is in neither sequence), A323162 (characteristic function).

Programs

  • Maple
    isA005381 := proc(n)
        not isprime(n) and not isprime(n-1) ;
    end proc:
    A005381 := proc(n)
        local a;
        option remember;
        if n = 1 then
            9;
        else
            for a from procname(n-1)+1 do
                if isA005381(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Jul 14 2015
    # second Maple program:
    q:= n-> ormap(isprime, [n, n-1]):
    remove(q, [$2..130])[];  # Alois P. Heinz, Dec 26 2021
  • Mathematica
    Select[Range[2, 200], ! PrimeQ[# - 1] && ! PrimeQ[#] &]
  • PARI
    is(n)=!isprime(n)&&!isprime(n-1) \\ M. F. Hasler, Jan 07 2019
    
  • Python
    from sympy import isprime
    def ok(n): return n > 3 and not isprime(n) and not isprime(n-1)
    print([k for k in range(122) if ok(k)]) # Michael S. Branicky, Dec 26 2021

Formula

Conjecture: pi(n)=Sum_{k=1..n} k mod a(m) mod a(m-1) ... mod a(1) mod 2, for all values 1Benedict W. J. Irwin, May 04 2016
As a check, take n=9, m=2, a(m)=10. Then we must take the numbers 1 through 9 and reduce them mod 10 then mod 9 then mod 2. The results are 1,0,1,0,1,0,1,0,0, whose sum is 4 = pi(9), as predicted. - N. J. A. Sloane, May 05 2016
For an attempt at a proof for the conjecture above, see the link. If it is true, then for n>2, isprime(n)=(n mod x) mod 2, where x is the largest a(n)<=n. - Benedict W. J. Irwin, May 06 2016