ken john

Greenhorn

Posts: 2

posted 6 years ago

- 1

Are you trying to implement it in Java? From the few lines of code you have provided- I assume you are not familiar with Java. If its a homework question please DoYourOwnHomework , and you cannot expect anyone here to just give you the program for the same.

The steps which I can think of-

- Find the prime numbers within 10000- You can get the algorithm for this from a lot of places or you can write one yourself.

- Now to find out if there are three 7's you can either- Convert the number into a string and find if it has three 7's or you can find individual digits in the number and see if it has three 7's. Again for the second method there's a standard approach and you can find this algorithm in programs that deal with reversing a number.

So once you have some code and not able to proceed further do let us know and we will help you out.

The steps which I can think of-

- Find the prime numbers within 10000- You can get the algorithm for this from a lot of places or you can write one yourself.

- Now to find out if there are three 7's you can either- Convert the number into a string and find if it has three 7's or you can find individual digits in the number and see if it has three 7's. Again for the second method there's a standard approach and you can find this algorithm in programs that deal with reversing a number.

So once you have some code and not able to proceed further do let us know and we will help you out.

Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook

posted 6 years ago

- 1

or you could generate every possible number with three sevens, then test to see if each is prime. I think there are only 40.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors