Problem 315
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.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
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
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.

 Posts: 100
 Joined: Sat Aug 29, 2009 8:49 pm
Problem 315
Last edited by LarryBlake on Sun Dec 19, 2010 6:30 pm, edited 1 time in total.

 Posts: 100
 Joined: Sat Aug 29, 2009 8:49 pm
Re: Problem 315
I think I didn't understand the question originally.
Let's say the first prime is 10000019. I don't calculate the transition from that to the next prime. I add up the digits and get 11, then add those and get 2, figuring out the transitions on the way. Then I go to the next prime.
1. Is that correct?
2. Do I clear Max's clock after I reach 2, or does that stay as the transition to the next prime?
EDIT: For those who read this, the answer to both questions is yes. Prime, then its transitions, then clear. Then next prime.
Let's say the first prime is 10000019. I don't calculate the transition from that to the next prime. I add up the digits and get 11, then add those and get 2, figuring out the transitions on the way. Then I go to the next prime.
1. Is that correct?
2. Do I clear Max's clock after I reach 2, or does that stay as the transition to the next prime?
EDIT: For those who read this, the answer to both questions is yes. Prime, then its transitions, then clear. Then next prime.
Re: Problem 315
Yes, the specification for the clock states "... and then it will go black, waiting for the next number.", and that holds for both Sam's and Max's implementation of the clock.
P.S. Did anyone else notice that the animation of Sam's clock (on the left) is a little weird  the first 1 of 11 doesn't appear in the same place as the 3 in 137 did.
P.S. Did anyone else notice that the animation of Sam's clock (on the left) is a little weird  the first 1 of 11 doesn't appear in the same place as the 3 in 137 did.
_{Jaap's Puzzle Page}
Re: Problem 315
A more important detail: both clocks should be at least 8 digits wide (it's not a mod 1000 problem, nor a 3digitshiftingwindowclock problem).jaap wrote:Did anyone else notice that the animation of Sam's clock (on the left) is a little weird  the first 1 of 11 doesn't appear in the same place as the 3 in 137 did.
Still a nice animation.
Re: Problem 315
Sam and Max have built very CLEVER clocks with a lot of features.arie wrote:A more important detail: both clocks should be at least 8 digits wide (it's not a mod 1000 problem, nor a 3digitshiftingwindowclock problem).jaap wrote:Did anyone else notice that the animation of Sam's clock (on the left) is a little weird  the first 1 of 11 doesn't appear in the same place as the 3 in 137 did.
Still a nice animation.
First of all their clocks use a proportional font. Clever isn't it?
Secondly, for larger numbers they use a smaller font automatically.
However, we didn't think it wise to highlight all the clever features of their clocks because that would distract from the problem.
Re: Problem 315
Wow! I clearly underestimated the abilities of Sam and Max.
Re: Problem 315
Hi,
I don't know if it will help, but in a previous question (one of the first 50 I believe) you called that same mathematical transition a digital sum, but now you call it a digital root. That was confusing. Perhaps you'd consider rephrasing it? (I see I'm not the first one who entered the forum to check about it).
Best regards.
I don't know if it will help, but in a previous question (one of the first 50 I believe) you called that same mathematical transition a digital sum, but now you call it a digital root. That was confusing. Perhaps you'd consider rephrasing it? (I see I'm not the first one who entered the forum to check about it).
Best regards.
Re: Problem 315
The digital root of a number is something else than calculating the sum of the digits of a number once.
See http://en.wikipedia.org/wiki/Digital_root, http://mathworld.wolfram.com/DigitalRoot.html
and Problem 159 (View Problem)
See http://en.wikipedia.org/wiki/Digital_root, http://mathworld.wolfram.com/DigitalRoot.html
and Problem 159 (View Problem)
Re: Problem 315
The problem states:
"The two clocks are fed all the prime numbers between A = 10^7 and B = 2x10^7. "
Does this mean I can just feed the primes from a file, or is calculating all the primes in this 10^7 interval count as running time? Does this too need to fit in the 1 minute rule?
"The two clocks are fed all the prime numbers between A = 10^7 and B = 2x10^7. "
Does this mean I can just feed the primes from a file, or is calculating all the primes in this 10^7 interval count as running time? Does this too need to fit in the 1 minute rule?
Re: Problem 315
That's entirely up to you.eppie wrote:Does this mean I can just feed the primes from a file, or is calculating all the primes in this 10^7 interval count as running time? Does this too need to fit in the 1 minute rule?
However it is possible to generate those primes very quickly (a few seconds at most), and having code that does that is very useful in many of the other problems.
_{Jaap's Puzzle Page}
Re: Problem 315
It's also a good idea to make yourself a file with all the primes up to 100 Mb. You then load whatever section is required for problems where primes are needed. There's no reason to recalculate all those primes each and every time you do need them. Consider it as one of your reusable tools.
When you assume something, you risk being wrong half the time.

 Posts: 6
 Joined: Thu Oct 13, 2011 2:01 am
Re: Problem 315
For some reason I get a wrong answer. Could please someone tell me if this is right:
last p < 2000000: 1999993
For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
Thanks, Jochen.
last p < 2000000: 1999993
For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
Thanks, Jochen.
Re: Problem 315
Those seem correct. I would assume you know that p=1999993 is not in the targeted range.For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
When you assume something, you risk being wrong half the time.
Re: Problem 315
Digital 6s and 9s
Does a 6 have the top horizontal bar, and 9 have the bottom horizontal bar (and this use 6 of the 7 bars each?) or do they only use 5 of them each?
Does a 6 have the top horizontal bar, and 9 have the bottom horizontal bar (and this use 6 of the 7 bars each?) or do they only use 5 of them each?

 Posts: 20
 Joined: Sun Sep 25, 2011 11:20 pm
Re: Problem 315
Take a closer look at the image and you'll see how every number is written.
Re: Problem 315
Heh i missed that part under it.
Though didnt matter I just ran it both ways and got the right answer in
Though didnt matter I just ran it both ways and got the right answer in

 Posts: 6
 Joined: Thu Oct 13, 2011 2:01 am
Re: Problem 315
Funny. Just forgotten a 0 in the start and end number of the loop ... Just took the right numbers now, and solution is correct.rayfil wrote:Those seem correct. I would assume you know that p=1999993 is not in the targeted range.For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
Thank you very much!
Re: Problem 315
I get the right numbers for all the test cases but wrong for the answer. Are the following numbers right for the gaps between the values of Max's clock and Sam's clock?
Code: Select all
1 0
2 0
3 0
5 0
7 0
11 2
13 6
17 6
19 18
23 8
29 8
31 4
37 14
41 2
43 6
47 10
53 10
59 16
61 4
67 14
71 4
73 16
79 18
83 10
89 16
97 12
Re: Problem 315
My guess is you forgot about the overhang on the 7. Just doing it in my head, 17 and 37 appear to be wrong. I didn't look much past that point.jake223 wrote:I get the right numbers for all the test cases but wrong for the answer. Are the following numbers right for the gaps between the values of Max's clock and Sam's clock?Code: Select all
1 0 2 0 3 0 5 0 7 0 11 2 13 6 17 6 19 18 23 8 29 8 31 4 37 14 41 2 43 6 47 10 53 10 59 16 61 4 67 14 71 4 73 16 79 18 83 10 89 16 97 12
Re: Problem 315
I get 37>10 is 2+3=5 and 10>1 is 2; (2+5)*2=14
I get 17>8 is 3; 3*2=6.
Both are correct. Thanks anyway.
I get 17>8 is 3; 3*2=6.
Both are correct. Thanks anyway.