OFFSET
1,1
COMMENTS
For any odd prime p, A000111(p) == (-1)^((p-1)/2) mod p, see A180418, so these cases are not considered further and left out of the sequence by definition.
Might be called "Zig-zag pseudoprimes."
It seems that every Carmichael number (A002997) <= 512461 is in the sequence. - D. S. McNeil, Sep 01 2010
LINKS
Vladimir Shevelev, The number of permutations with prescribed up-down structure as a function of two variables, INTEGERS 12 (2012), article #A1. - From N. J. A. Sloane, Feb 07 2013
MATHEMATICA
fQ[n_] := ! PrimeQ@n && Mod[ (-1)^((n - 1)/2)*2^(n + 1)*(2^(n + 1) - 1)*BernoulliB[n + 1]/(n + 1), n] == Mod[(-1)^((n - 1)/2), n]; k = 3; lst = {}; While[k < 50000, If[ fQ@k, AppendTo[lst, k]; Print@k]; k += 2]; lst (* Robert G. Wilson v, Sep 29 2010 *)
PROG
(Python)
from itertools import count, islice, accumulate
from sympy import isprime
def A180942_gen(): # generator of terms
blist = (0, 1)
for n in count(2):
blist = tuple(accumulate(reversed(blist), initial=0))
if n & 1 and (blist[-1] + (1 if (n-1)//2 & 1 else -1)) % n == 0 and not isprime(n):
yield n
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Sep 27 2010
EXTENSIONS
Extended to a(13) by D. S. McNeil, Sep 01 2010
Comments rephrased by R. J. Mathar, Sep 29 2010
a(14)-a(17) from Robert G. Wilson v, Sep 29 2010
a(18)-a(38) from Amiram Eldar, Dec 28 2019
STATUS
approved