Page 1 of 2
Problem 315
Posted: Sun Dec 19, 2010 3:39 pm
by LarryBlake
Problem 315 (
View Problem)
Ignore this post. Sorry.
Re: Problem 315
Posted: Sun Dec 19, 2010 6:21 pm
by LarryBlake
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.

Re: Problem 315
Posted: Sun Dec 19, 2010 11:47 pm
by jaap
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.
Re: Problem 315
Posted: Mon Dec 20, 2010 12:29 pm
by arie
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.
A more important detail: both clocks should be at least 8 digits wide (it's not a mod 1000 problem, nor a 3-digit-shifting-window-clock problem).
Still a nice animation.
Re: Problem 315
Posted: Mon Dec 20, 2010 2:18 pm
by hk
arie wrote: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.
A more important detail: both clocks should be at least 8 digits wide (it's not a mod 1000 problem, nor a 3-digit-shifting-window-clock problem).
Still a nice animation.
Sam and Max have built very CLEVER clocks with a lot of features.
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
Posted: Mon Dec 20, 2010 5:07 pm
by arie
Wow! I clearly underestimated the abilities of Sam and Max.

Re: Problem 315
Posted: Tue Dec 21, 2010 9:30 pm
by random_dg
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.
Re: Problem 315
Posted: Tue Dec 21, 2010 9:49 pm
by hk
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)
Re: Problem 315
Posted: Wed Sep 07, 2011 6:20 am
by eppie
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?
Re: Problem 315
Posted: Wed Sep 07, 2011 8:33 am
by jaap
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?
That's entirely up to you.
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.
Re: Problem 315
Posted: Thu Sep 08, 2011 2:53 am
by rayfil
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.
Re: Problem 315
Posted: Thu Oct 13, 2011 2:06 am
by jochenkeutel
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.
Re: Problem 315
Posted: Thu Oct 13, 2011 3:12 am
by rayfil
For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
Those seem correct. I would assume you know that p=1999993 is not in the targeted range.
Re: Problem 315
Posted: Wed Oct 26, 2011 10:09 pm
by drwhat
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?
Re: Problem 315
Posted: Wed Oct 26, 2011 11:10 pm
by mynameisalreadytaken
Take a closer look at the image and you'll see how every number is written.
Re: Problem 315
Posted: Thu Oct 27, 2011 2:07 am
by drwhat
Heh i missed that part under it.
Though didnt matter I just ran it both ways and got the right answer in

Re: Problem 315
Posted: Fri Oct 28, 2011 8:03 pm
by jochenkeutel
rayfil wrote:For this p=1999993:
Sam needs 116 transitions.
Max needs 78 transitions.
Those seem correct. I would assume you know that p=1999993 is not in the targeted range.
Funny. Just forgotten a 0 in the start and end number of the loop ... Just took the right numbers now, and solution is correct.
Thank you very much!
Re: Problem 315
Posted: Mon Jun 03, 2013 3:10 pm
by jake223
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
Posted: Mon Jun 03, 2013 9:05 pm
by mdean
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
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.
Re: Problem 315
Posted: Tue Jun 04, 2013 5:07 pm
by jake223
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.