Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (adeelasifmehmod):

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below 10000?write in c++

OpenStudy (rsmith6559):

What is giving you problems?

OpenStudy (adeelasifmehmod):

rotation of numbers after getting prime numbers

OpenStudy (rsmith6559):

int mod = prime % 10; int divisor = prime / 10; // could be replaced with a recursive function to find the power of ten to // multiply mod by, but with only four possibilites...... if( divisor < 10 ) mod *= 10; else if( divisor < 100 ) mod *= 100; else if( divisor < 1000 ) mod *= 1000; else mod *= 10000; divisor += mod; // divisor is prime shifted right one digit // not tested, try with a few and cout results

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!