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.

A166460 Numbers k such that k + (-1)^k is not prime.

Original entry on oeis.org

0, 1, 5, 7, 8, 9, 11, 13, 14, 15, 17, 19, 20, 21, 23, 24, 25, 26, 27, 29, 31, 32, 33, 34, 35, 37, 38, 39, 41, 43, 44, 45, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 61, 62, 63, 64, 65, 67, 68, 69, 71, 73, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Oct 14 2009

Keywords

Comments

This is the complement of A068499 (except that both include 1 as a term).
From Don Reble, Aug 31 2021: (Start)
Proof for all k except 0, 1, 3 with cases
(i) If k is odd and >=5, then k+1 = 2*x, 2 < x < k, k! = k*...*x*...*2*1
A068499: k+1 divides k! : absent
A166460: k-1 is even and composite : present
(ii) If k is even and k+1 is prime,
A068499: k+1 does not divide k! : present
A166460: k+1 is prime : absent
(iii) If k is even and k+1 = p^2 is the square of a (odd) prime, then k+1 >= 3p, k > 2p.
A068499: k! = k*...*2p*...*p*...*1;
k+1 divides k! : absent
A166460: k+1 is composite : present
(iv) If k is even and k+1 is composite but not the square of a prime, then there are two distinct factors x*y = k+1:
3 <= x < y = (k+1)/x < k.
A068499: k! = k*...*y*...*x*...*1:
k+1 divides k! : absent
A166460: k+1 is composite : present
(End)

Examples

			0 + (-1)^0 = 1 is not prime, which adds 0 to the sequence.
5 + (-1)^5 = 4 is not prime, which adds 5 to the sequence.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 94], ! PrimeQ[# + (-1)^#] &] (* Michael De Vlieger, Sep 08 2021 *)
  • Python
    from sympy import composite
    def A166460(n): return composite(n-1)-1 if n>2 else n-1 # Chai Wah Wu, Aug 27 2024

Formula

a(n) = A002808(n-1)-1 for n>2. - Chai Wah Wu, Aug 27 2024

Extensions

0 added by R. J. Mathar, Oct 21 2009