OFFSET
1,1
COMMENTS
These might be called "Carmichael pseudo-twin-primes".
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
For every b coprime to a(n)*(a(n)+2), 2*b^(a(n)+1) == (b^2-1)*(a(n)+2) (mod a(n)*(a(n)+2)). Conversely (Max Alekseyev), if for every b coprime to N*(N+2), 2*b^(N+1) == (b^2-1)*(N+2) (mod N*(N+2)), then N is in the sequence. - Vladimir Shevelev, Oct 14 2011
MAPLE
with(numtheory):
ic:= proc(n) local p;
if not issqrfree(n) then false
else for p in factorset(n) do
if irem (n-1, p-1)<>0 then return false fi
od; true
fi
end:
a:= proc(n) option remember; local k;
for k from 2 +`if`(n=1, 1, a(n-1)) by 2 while
isprime(k) and isprime(k+2) or not (ic(k) and ic(k+2))
do od; k
end:
seq(a(n), n=1..10); # Alois P. Heinz, Oct 12 2011
MATHEMATICA
terms = 31; bMax = 20(* sufficient for 31 terms *); coprimes[n_] := Select[ Range[bMax], CoprimeQ[#, n]&]; Reap[For[n = m = 1, m <= terms, n += 2, If[CompositeQ[n] || CompositeQ[n+2], If[AllTrue[coprimes[n(n+2)], PowerMod[#, n-1, n] == 1 && PowerMod[#, n+1, n+2] == 1&], Print["a(", m, ") = ", n]; Sow[n]; m++]]]][[2, 1]] (* Jean-François Alcover, Mar 28 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Oct 12 2011
STATUS
approved