OFFSET
0,3
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..121
MATHEMATICA
Nest[Append[#1, #2 #1[[-#2]] ] & @@ {#, If[First@ # > 0, 1, Length@ First@ Split@ # + 1] &@ SquaresR[Range@ 4, Length@ #]} &, {1}, 50] (* Michael De Vlieger, Nov 25 2018, after Harvey P. Dale at A002828 *)
PROG
(PARI)
istwo(n:int) = { my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1 };
isthree(n:int) = { my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7 };
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 24 2018
STATUS
approved