OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
24 is 11000 in binary. This binary representation has three 0's and 3 divides 24. Also, the binary representation has two 1's and 2 also divides 24. So 24 is in the sequence.
MAPLE
filter:= proc(n) local L, x, m;
L:= convert(n, base, 2);
x:= convert(L, `+`);
m:= nops(L);
x < m and n mod x = 0 and n mod (m-x) = 0
end proc:
select(filter, [$1..1000]);
MATHEMATICA
bdQ[n_]:=Module[{idn2=IntegerDigits[n, 2], x, y}, x=Count[idn2, 1]; y=Count[ idn2, 0]; If[x==0, x=n+1]; If[y==0, y=n+1]; And@@Divisible[n, {x, y}]]; Select[ Range[500], bdQ] (* Harvey P. Dale, Jan 22 2012 *)
PROG
(C) #include <stdio.h> int main(int argc, char *argv[]) { for(int n=1; n< 500 ; n++) { int digs[2] ; int nshifted=n ; digs[0]=digs[1]=0 ; while(nshifted) { digs[ nshifted & 1]++ ; nshifted >>= 1 ; } if ( digs[0] && digs[1]) if( ( n % digs[0]) == 0 && (n %digs[1]) ==0) printf("%d, ", n) ; } } /* R. J. Mathar, Apr 03 2006 */
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Leroy Quet, Mar 30 2006
EXTENSIONS
More terms from R. J. Mathar, Apr 03 2006
STATUS
approved