LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Abundant number NI Days UK 2014

For those who attended the Challenge the Champions session on the UK NI Days this Noverber 2014, one of the challenges set was to find the 1000th abundant number in the most efficient way possible.

 

I've just had a quick play, and this is my solution for anyone who is interested or fancies trying to beat it...

 

Message 1 of 5
(3,075 Views)

Here is a code that is about 4 times efficienter.

 

timing statistics.png

Message 2 of 5
(3,001 Views)

I like it! Clever way of finding the proper divisors (although beiing picky, your comment about there not being proper divisors > sqrt(n) isn't true.)

 

I found that using a shift register initialised with a 2 and then a single increment each time was faster than doing ($i++)++;

0 Kudos
Message 3 of 5
(2,987 Views)

@Richard_Ha wrote:

I like it! Clever way of finding the proper divisors (although beiing picky, your comment about there not being proper divisors > sqrt(n) isn't true.)


Yeah, I just edited your condition, without rethinking the fact. Th enote is untru, but them I merge the factors.

 


Richard_Ha wrote:

I found that using a shift register initialised with a 2 and then a single increment each time was faster than doing ($i++)++;


I'm not sure about it. I don't say either of them is quicker, jsut wondering.  Did you benchmark it?

0 Kudos
Message 4 of 5
(2,980 Views)

 


Richard_Ha wrote:

I found that using a shift register initialised with a 2 and then a single increment each time was faster than doing ($i++)++;


I'm not sure about it. I don't say either of them is quicker, jsut wondering.  Did you benchmark it?


Yeah, it was only a small gain, but it was in there. I didn't try a i+2 though.

Message 5 of 5
(2,973 Views)