algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: "Ujjaval" <ujjaval@xxxxxxxxx>
- Date: 23 Jan 2006 15:37:43 -0800
Hey all,
I want to get the numbers from 0-16384 whose equivalent binary number
has at the most 4 1s in it.
I can do this by setting up a counter and doing an AND operation of a
number with all numbers which are power of 2 between 0-16384. I update
the couter for each successful AND operation and at the end check
whether the counter is <= 4 or not.
Is there any more efficient way to do this??
Thanks,
Ujjaval
.
- Follow-Ups:
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: Pubkeybreaker
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: john_ramsden
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: Jn
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: Erik Naggum
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- From: mensanator@xxxxxxxxxxx
- Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- Prev by Date: Re: A question about Probable Primes
- Next by Date: Re: Cantorian pseudomathematics
- Previous by thread: fourier series
- Next by thread: Re: algorithm to identify number from 0-16384 having at most 4 1s in its binary number
- Index(es):
Relevant Pages
|