MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodaySearch Solutions

1 – 10 of 10 previous next

117Size

0 Comments

53Size

0 Comments

48Size

0 Comments

106Size

1 Comment

1 Comment

J.R.! Menzinger
on 10 May 2014

Brute force explodes for really big radius... :'(

91Size

0 Comments

117Size

0 Comments

1 player likes this solution

70Size

0 Comments

124Size

0 Comments

68Size

1 Comment

1 Comment

Jean-Marie SAINTHILLIER
on 29 Mar 2013

Just to study Tim and James solutions.

57Size

3 Comments

2 players like this solution

3 Comments

Jean-Marie SAINTHILLIER
on 28 Mar 2013

Can you explain your solution ?

Tim
on 28 Mar 2013

This is derived from the Mathematica algorithm for sequence A046080 at oeis.org (arrived at from A046109). Instead of factoring (because of the large integers) it checks for divisibility by the various primes (up to 325643, which is enough to handle the test set).

Jan Orwat
on 13 May 2014

It seems to be around 4 times faster than solution with factoring for this testsuite. But you have to pay with incorrect answer for relatively small radius such as 326441 (prime) :-/

1 – 10 of 10 previous next