OFFSET
1,2
COMMENTS
A union of 1, 4, primes, quadrupled primes, and all numbers of the form 4k+2. - Ivan Neretin, Aug 12 2015
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
Proper divisors of 42 are {1,2,3,6,7,14,21}: 4=#{1,3,7,21} are odd and 3=#{2,6,14} are even, as abs(4-3)=1, 42 is a term.
MAPLE
filter:= n -> if n::odd then isprime(n) elif n mod 4 = 0 then isprime(n/4) else true fi:
filter(1):= true: filter(4):= true:
select(filter, [$1..1000]); # Robert Israel, Aug 12 2015
MATHEMATICA
okQ[n_] := With[{dd = Most[Divisors[n]]},
Abs[2 Count[dd, _?OddQ] - Length[dd]] <= 1];
Select[Range[1000], okQ] (* Jean-François Alcover, Dec 16 2021 *)
PROG
(PARI) is(n)=if(bittest(n, 0), isprime(n), bittest(n, 1)||isprime(n>>2))||n<9 \\ M. F. Hasler, Aug 13 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jun 18 2004
STATUS
approved