English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How to calculate prime no in bit pattern..??

2006-10-22 21:49:02 · 5 answers · asked by prasad3435 2 in Science & Mathematics Mathematics

5 answers

7 bits goes up to 2^7 - 1 = 127. Since 127 is itself prime, 127 is the largest prime that can be stored in 7 bits. I don't think there's a formula to generalize this for different numbers of bits, so you'd need to use a table of primes.

2006-10-22 21:53:19 · answer #1 · answered by DavidK93 7 · 0 0

As often happens, the real answer is "it depends". 7 bits can be used to store non-negative integers, in which caseas others have said it is the largest prime number < 2^7, or 127.

If the 7 bits store positive or negative integers in one's complement, then it is the largest prime < 63, or 61.

While for 7 bits this would be a little odd, if you asked for a larger number it could be storing a real number, with mantissa and exponent.

Some older computers worked in decimal, where 4 bits gave a single decimal digit. So there are lots of possibilities, depending on how the bits are interpreted. (in a program I could use 7 bits to index the primes, in which case the largest prime number stored would be 719, I think , the 128th prime). But you probably want 127.

2006-10-23 00:33:03 · answer #2 · answered by sofarsogood 5 · 0 0

I have no idea of calculating prime number in bit pattern. But the largest prime number that can be stored in a 7-bit binary pattern is 127. It will be written as: 1111111 in binary.

2006-10-22 22:03:41 · answer #3 · answered by mkm 2 · 0 0

1111111, i.e. 127 base ten is prime.

A related question is to ask which numbers of the binary form 111111....1111 are prime. These numbers are called Mersenne primes.

2006-10-22 21:54:52 · answer #4 · answered by bag o' hot air 2 · 0 0

1111111 i.e, 127

2006-10-22 22:25:22 · answer #5 · answered by . 3 · 0 0

fedest.com, questions and answers