OFFSET
1,3
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)
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A002808(n-1)-1 for n>2. - Chai Wah Wu, Aug 27 2024
EXAMPLE
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.
MATHEMATICA
Select[Range[0, 94], ! PrimeQ[# + (-1)^#] &] (* Michael De Vlieger, Sep 08 2021 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, Oct 14 2009
EXTENSIONS
0 added by R. J. Mathar, Oct 21 2009
STATUS
approved