to get more knowledge in 'c'

C

Christopher Layne

anand said:
hi friends,
i need some one to frame me questions for to write programs,it
might be simple ones like prime no. prg but i need this type of
coaching for to develop my programming knowledge

You're asking others how to challenge yourself? I don't think you're going to
get far in life on that mantra.
 
J

jmcgill

anand said:
hi friends,
i need some one to frame me questions for to write programs,it
might be simple ones like prime no. prg


Simple? Like prime no. prg? !?!?

Ok. Find the first 45 prime numbers n, such that 2^n-1 is also prime.
.... ;-)
 
R

Richard Heathfield

jmcgill said:
Simple? Like prime no. prg? !?!?

Ok. Find the first 45 prime numbers n, such that 2^n-1 is also prime.
... ;-)

2 is the only such number.

Proof that it is such a number: 2 - 1 is 1, and 2 ^ 1 is 3.

Proof that it is the only such number: Let n be any positive integer greater
than 2. Either n is even (in which case it is not prime), or n - 1 is even
and therefore either 2 or not prime (and xoring it with 2 will not change
its parity, but will zero it if it is 2, and 0 is not prime).
 
J

jmcgill

Richard said:
2 is the only such number.

Proof that it is such a number:

Ahhhh, great answer!

I meant, as shirley you realize, (2 raised to the power of n), minus 1.

I appreciate being called out on my lack of precision (really).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top