Problem 035

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Doodpants
Posts: 2
Joined: Tue Mar 25, 2008 3:06 pm

Problem 035

Post 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.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 35 needs clarification

Post 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.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
Doodpants
Posts: 2
Joined: Tue Mar 25, 2008 3:06 pm

Re: Problem 35 needs clarification

Post 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.
Last edited by Doodpants on Tue Mar 25, 2008 8:47 pm, edited 1 time in total.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 35 needs clarification

Post 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?
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
3n1gm4
Posts: 34
Joined: Sun Jul 20, 2008 1:46 pm

Problem 35

Post 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
Tirian
Posts: 25
Joined: Sun May 18, 2008 1:35 am

Re: Problem #35

Post 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.
3n1gm4
Posts: 34
Joined: Sun Jul 20, 2008 1:46 pm

Re: Problem #35

Post 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...
Tirian
Posts: 25
Joined: Sun May 18, 2008 1:35 am

Re: Problem #35

Post by Tirian »

Sorry!
Last edited by rayfil on Fri Jul 25, 2008 7:06 pm, edited 1 time in total.
Reason: Deleted text. Too much info provided.
3n1gm4
Posts: 34
Joined: Sun Jul 20, 2008 1:46 pm

Re: Problem #35

Post by 3n1gm4 »

If you solve a problem, you can post your comments/solution on the forum for that specific problem!
Last edited by rayfil on Fri Jul 25, 2008 7:08 pm, edited 1 time in total.
Reason: Too much info provided
bugale
Posts: 2
Joined: Sun Jan 25, 2009 4:13 pm

Problem 035

Post 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?
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 035

Post 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)
Last edited by stijn263 on Sun Jan 25, 2009 4:49 pm, edited 1 time in total.
bugale
Posts: 2
Joined: Sun Jan 25, 2009 4:13 pm

Re: Problem 035

Post by bugale »

ooooo...
now I see it. Thank you :D
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 035

Post 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.
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 035

Post 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..
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 035

Post 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.
Image
War ruins the life and health of untold numbers of innocent children.
jabbalaci
Posts: 5
Joined: Fri Aug 19, 2011 9:40 am

Re: Problem 035

Post 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.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 035

Post 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.
Image
War ruins the life and health of untold numbers of innocent children.
jabbalaci
Posts: 5
Joined: Fri Aug 19, 2011 9:40 am

Re: Problem 035

Post 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.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 035

Post 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.
Image
War ruins the life and health of untold numbers of innocent children.
pimspelier
Posts: 41
Joined: Tue Jan 21, 2014 2:06 pm
Location: The Netherlands

Re: Problem 035

Post 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?
Image
Post Reply