Page 1 of 2

Problem 035

Posted: Tue Mar 25, 2008 3:10 pm
by Doodpants
Problem 35 took me forever to get right, because I didn't realize that, for example, 007999 and 079990 are not considered rotations of 999007. It would be nice if the problem clarified the term "rotation" for numbers containing zeroes.

Re: Problem 35 needs clarification

Posted: Tue Mar 25, 2008 3:22 pm
by daniel.is.fischer
That is not necessary, because if a number contains a zero, (at least) one of its rotations will be divisible by 10. So there's no need to decide whether 007999 is a rotation of 999007 because 799900 definitely is.

Re: Problem 35 needs clarification

Posted: Tue Mar 25, 2008 8:34 pm
by Doodpants
Yes, but the problem is, suppose for instance that 7999 is actually a circular prime; then the test for 999007 sabotages it, marking it as not a circular prime! This is exactly the issue I faced with my solution, and why I kept counting a lot fewer circular primes than there actually are.

The problem description states that there are 13 circular primes below 100, and when I tested my program with a limit of 100, I got the correct answer of 13. Then when I tested it with 1,000,000, I kept getting 16 as an answer. Claiming that only 3 circular primes existed between 100 and 1,000,000! I checked and re-checked my program looking for bugs or miscalculations, and it was very frustrating. Finally I managed to figure out what was going on, and changed my rotation function to throw out rotations that began with 0, and I got the right answer.

Re: Problem 35 needs clarification

Posted: Tue Mar 25, 2008 8:45 pm
by daniel.is.fischer
Okay, then the general rule that all numbers are written without leading zeros applies. As far as I remember that is only explicitly mentioned (for redundant emphasis) when we specifically ask for d-digit numbers. Perhaps the fact that sometimes it is mentioned leads to confusion?

Problem 35

Posted: Fri Jul 25, 2008 4:35 pm
by 3n1gm4
I checked my code so many times, I still don't understand my mistake...

That's the result for 10^i with i from 1 to 6

10^1: 4
10^2: 13
10^3: 32
10^4: 53
10^5: 90
10^6: [WRONG]

I know that for 10^6 it's wrong (when I post it the problem say so :D )
I know that for 10^1 and 10^2 results are correct. Are the others wrong? it is possible it does not work only for higher values? :O

Re: Problem #35

Posted: Fri Jul 25, 2008 5:13 pm
by Tirian
They're all wrong after the first two.

Why don't you post all 32 values less than 1000. Then we could either identify one that wasn't a solution or one that was missing.

Re: Problem #35

Posted: Fri Jul 25, 2008 5:20 pm
by 3n1gm4
2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 113, 131, 197, 199, 307, 311, 337, 373, 701, 709, 719, 733, 907, 919, 971, 991

Here they are :O

I think is 101's fault, 110 is not prime but my program does not care... I'll try to solve this...

Re: Problem #35

Posted: Fri Jul 25, 2008 5:26 pm
by Tirian
Sorry!

Re: Problem #35

Posted: Fri Jul 25, 2008 5:32 pm
by 3n1gm4
If you solve a problem, you can post your comments/solution on the forum for that specific problem!

Problem 035

Posted: Sun Jan 25, 2009 4:22 pm
by bugale
Hi.
I am currently stuck on problem 35.
I have a program in VB Net:

Code: Select all

snip
I know it is not fast but I dont care...
Anyway, I get 22 as the answer
I get these numbers: 2,3,5,7,11,13,17,31,37,71,73,79,97,113,131,199,311,337,373,733,919,991 in my list....
But when I try to put 22 as the answer it says "WRONG!!!!"
I also found this: http://en.wikipedia.org/wiki/Permutable_prime
There are exactly 22 permutable primes(circular primes)!!!!!!!!!!!!!
What am I doing wrong?

Re: Problem 035

Posted: Sun Jan 25, 2009 4:35 pm
by stijn263
There's a difference between a permutation and a rotation as you could've seen yourself from the example, 197.

Problem 35 (View Problem)

Re: Problem 035

Posted: Sun Jan 25, 2009 4:44 pm
by bugale
ooooo...
now I see it. Thank you :D

Re: Problem 035

Posted: Sun Jan 25, 2009 7:33 pm
by hk
PLEASE DON'T ENTER PROGRAMS

And by the way there was already a topic for this Problem.
Well go ahead and make the whole thread unreadable to yourself and others. Or are the moderators to look after these things if you guys are too lazy to do so.

Re: Problem 035

Posted: Sun Jan 25, 2009 7:37 pm
by stijn263
Hans Klein wrote:[large red capital letters]please don't enter programs[/large red capital letters]
then say so in the first post of this topic..

Re: Problem 035

Posted: Sun Jan 25, 2009 7:40 pm
by hk
Ever read the contact form on the main website:
Contact
The preferred way to contact a Project Euler team member is via the alternative phpBB forum. The team visit regularly and are able to deal with most issues quickly and efficiently. You can also use this forum to make suggestions about the website or ask for hints on the current problems, but as your posts will be visible to all members you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

Web Address: http://projecteuler.chat
Forum Administrators: harryh, rayfil, ed_r, xan, hk, daniel.is.fischer


Alternatively you can use this form to submit an idea for a new problem to one of the development team leaders. Do not use this contact form for technical issues, suggestions about the website, or issues relating to one of the current problems; messages of this nature will be ignored. Instead use the alternative forum (see above).

If you wish to contact another member at Project Euler then please use the "envelope" icon found next to his/her username.
It is not a school class here.

Anyhow, I did so. Let's see if that helps.

Re: Problem 035

Posted: Fri Aug 19, 2011 9:50 am
by jabbalaci
The problem statement should be clearer, I also had problems with this one. First I thought I should generate all the permutations of a prime. When I tested with numbers below 100, I got the correct result. I noticed a day later that instead of "permutation" we must use "rotation". In a footnote it should be made clear with some more examples.

Re: Problem 035

Posted: Fri Aug 19, 2011 10:02 am
by hk
The first line of the problem statement reads:
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
Analysing this line you can note a few things:
1) it's stated there that we are talking about rotations and not about permutations.
2)There are 6 permutations of the digits 197, not three. So if you accidentally would have read "permutations" you would have had to wonder where the other three permutations had gone.

So IMHO the first line contains every information you need.

Re: Problem 035

Posted: Fri Aug 19, 2011 6:11 pm
by jabbalaci
hk wrote:The first line of the problem statement reads:
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
Analysing this line you can note a few things:
1) it's stated there that we are talking about rotations and not about permutations.
2)There are 6 permutations of the digits 197, not three. So if you accidentally would have read "permutations" you would have had to wonder where the other three permutations had gone.

So IMHO the first line contains every information you need.
Although that line contains every information, it's very easy to misread it. Right before this exercise I solved some that included permutation, so when I saw "197, 971, and 719", I thought of permutation immediately without noticing that three permutations are missing. What I want to say is that some warning in a footnote would be useful.

Re: Problem 035

Posted: Fri Aug 19, 2011 9:09 pm
by hk
I don't see any need to add notes to a problem where all necessary information is given concisely in the first sentence.

Re: Problem 035

Posted: Sat Feb 22, 2014 10:33 am
by pimspelier
Hello,

I'm currently trying to solve this problem, but my rotation function doesn't work well enough: the rotation of 1234: 4123, but 123: 311. It seems, that with numbers with an odd number of digits, it gives the rotation-1. Does anybody know what I could be doing wrong/can I PM my code to anyone who understands C?