A360799 Numbers m with m mod 3 = q, q != 2, such that the number of ones in its base-2 representation is even if q=0 and odd if q=1.
0, 1, 3, 4, 6, 7, 9, 12, 13, 15, 16, 18, 19, 22, 24, 25, 27, 28, 30, 31, 33, 36, 37, 39, 45, 48, 49, 51, 52, 54, 55, 57, 60, 61, 63, 64, 66, 67, 70, 72, 73, 75, 76, 78, 79, 82, 88, 90, 91, 94, 96, 97, 99, 100, 102, 103, 105, 108, 109, 111, 112, 114, 115, 118, 120, 121
Offset: 0
Keywords
Examples
5 X 4 wall is tiled bottom-up with 1 X 2 dominos: _ ___ ___ _ _ _ _ _ ___| | |_ _|___| | _ | | |_ ___ | | |_ _|_| | | |_ _|_| ___| |___ |_|_| |___| |_|_| |___| |_|_| |___| |___|_|___| |___|_|___| |___|_|___| |___|_|___| 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 4 = a(3) 24 = a(14) 1 = a(1) 0 = a(0)
Programs
-
Maxima
block(kmax: 100, a:[], even_ones(x):= block(su:0, while x>0 do(p: mod(x,2), x:(x-p)/2, su:su+p), return(mod(su,2))), for k from 0 thru kmax do(r:mod(k,3), if r<2 and r=even_ones(k) then a:append(a,[k])),a);
-
PARI
isok(m) = my(k=m%3); if (hammingweight(m) % 2, k==1, k==0); \\ Michel Marcus, Feb 27 2023
Comments