Link to home
Start Free TrialLog in
Avatar of prasad2315
prasad2315

asked on

get prime numbers in a random sequence using bit shift operators

how to generate prime numbers in a random sequence  using bitwise operators
Avatar of Infinity08
Infinity08
Flag of Belgium image

What do you mean by "in random sequence" ? Why using bitwise operators ?

What is this for ?

Do you want prime numbers within a certain range ? Or just any prime numbers ?
Avatar of prasad2315
prasad2315

ASKER

i mean prime numbers in a range

how to generate prime numbers with in a certain range using bit operators ?
this was the question asked to me in an interview
I'm not sure there is enough info in the Q to provide and effective or useful answer.
I've got the same impression that there's something missing ... What's the relation between prime numbers and bitwise operations ?
I8. Actually I don't know why I'm monitoring this TA as numbers are definitely your thing and not mine -- I am a self confessed Numerophobe :->
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might use bit operators in a Feedback Shift Register pseudo-random number generator to select the random prime once it has been generated.
you might use a binary GCD algorithm for trial divisions.
You might shift by the word size to get a bit mask and an array index for doing a sieve that uses more bits than your word size.
Or maybe you want to find primes in GF(2)