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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Search Solutions

1 – 29 of 29 previous next

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

1 Comment

1 Comment

J.R.! Menzinger
on 10 May 2014

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

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

0 Comments

Incorrect

1 Comment

1 Comment

Jean-Marie Sainthillier
on 29 Mar 2013

Just to study Tim and James solutions.

Incorrect

0 Comments

Incorrect

3 Comments

3 Comments

Marco Castelli
on 26 Mar 2013

Cases (from 6 to 9) of Test Suite are too long te caltulate: Mathwork's server give a error.

James
on 26 Mar 2013

They can be calculated with relative ease without switch/case or if/then commands. There's just a trick on how to do so.

Marco Castelli
on 27 Mar 2013

Otherwise part of my solution can calculate every small case but with giant radius give error. I will provide a new solution

Incorrect

4 Comments

2 players like this solution

4 Comments

Show
1 older comment

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) :-/

James
on 27 May 2015

I just came back to this problem for the first time in a long time for help with another problem. I changed the test suite for a few of the solutions that don't work with all of the radii.

1 – 29 of 29 previous next