login
Binary numbers (written in decimal) such that the sum of digits mod 2 equals the product of digits mod 2.
0

%I #12 Dec 04 2013 13:19:22

%S 0,1,5,6,7,9,10,12,17,18,20,23,24,27,29,30,31,33,34,36,39,40,43,45,46,

%T 48,51,53,54,57,58,60,65,66,68,71,72,75,77,78,80,83,85,86,89,90,92,95,

%U 96,99,101,102,105,106,108,111,113,114,116,119,120,123,125

%N Binary numbers (written in decimal) such that the sum of digits mod 2 equals the product of digits mod 2.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F A083420 UNION (A001969 \ {3}). - _Ralf Stephan_, Nov 30 2013

%e 23 is in the sequence because 23 in binary is 10111. The sum of digits is 4 == 0 mod 2 and the products of digits is 0 == 0 mod 2.

%o (JavaScript)

%o for (i=0;i<1000;i++) {

%o s=i.toString(2).split("");

%o sl=s.length;

%o c=0;d=1;

%o for (j=0;j<sl;j++) {c+=s[j]*1;d*=s[j];}

%o c%=2;d%=2;

%o if (c==d) document.write(i+", ");

%o }

%o (PARI) is(n)=b=binary(n);sum(i=1,#b,b[i])%2==prod(i=1,#b,b[i])%2 \\ _Ralf Stephan_, Nov 30 2013

%K nonn,base

%O 0,3

%A _Jon Perry_, Nov 28 2013