[Challenge] Program Contest #1. Amicable numbers.

Posts 115 of 19 · Page 1 of 2
[Challenge] Program Contest #1. Amicable numbers.
Alright guys, here it is. The first of the programming contest in the coders lounge. This week, the theme is "Amicable Numbers" and the question you must provide a solution for is the following:

Quote Originally Posted by Question
Find the sum of all the amicable numbers under 15000
Obviously you'll need to do some research on amicable numbers before hand. Don't even think about leeching code because I will do a thorough search of related solutions to make sure there is no leeching going on. I know Wes has a working solution already, as may a few people, but that's fine.

You have exactly 1 week to complete a solution. Upon completing your solution, you must send me a PM with a pastebin link to your code and the title being: "Programming Contest #1:" followed by the answer. I'll keep tabs on who delivers their solutions first (note, as there are multiple people in different timezones, each entry will be classified into the 'day' it was released (i.e, day one, day two...etc) Points will be awarded for an elegant, efficient and original solution

So, you have your question, you have a week to complete it. Let's see some fucking sexy code. This question may seem a little bit like "wtf" at first, but I assure you it's pretty easy. I decided to keep the first one relatively simple, because I don't want to discourage people so early on in the contests.

Have at it!

I'll be coding mine in PHP
I solved about an hour ago, but improved it a bit =3 1297 msec was fastest I clocked it at.

Good luck everyone
I've got my algorithm ... But I'm on my way to school T.T

By the time I get home + doctor it'll be like day 2 :/
Quote Originally Posted by freedompeace View Post
I've got my algorithm ... But I'm on my way to school T.T

By the time I get home + doctor it'll be like day 2 :/
You're in australia too... You have like 18 hours til day 2 lol.
Quote Originally Posted by Jason View Post


You're in australia too... You have like 18 hours til day 2 lol.
I give up lol. I was Googling about what an amicable number was, found this CodeProject link, explained it quite well... problem was, it had accompanying code and now I can't get it off my mind. Did some code and it uses a similar algorithm :/
Quote Originally Posted by freedompeace View Post
I give up lol. I was Googling about what an amicable number was, found this CodeProject link, explained it quite well... problem was, it had accompanying code and now I can't get it off my mind. Did some code and it uses a similar algorithm :/
The algorithm is pretty obvious anyway, I'm sure most people will devise something similar anyway :P

The two solutions I've seen so far (HD's and master131's) both use a nearly identical method.
@Synchromanica: You're better off bruteforcing, the algorithms I found on google(based on p q and r being primes etc) only generate a few of the pairs, so you won't have all of them.

Have a look at A063990 - OEIS
Quote Originally Posted by Hell_Demon View Post
@Synchromanica: You're better off bruteforcing, the algorithms I found on google(based on p q and r being primes etc) only generate a few of the pairs, so you won't have all of them.

Have a look at A063990 - OEIS
Thanks for that :)

Mm, I'll try again tomorrow then if I have time :)
Coming Soon.
I completed it but it runs very slowly, oh wellz.
Quote Originally Posted by Void View Post
I completed it but it runs very slowly, oh wellz.
Like 15 mins so far and it ain't even halfway yet

Hell Daddy's runs in 290ms

EDIT: Sorry David, the answer was incorrect (I actually left the program running for 90 mins so it could figure that out /fp)
LOL my bad, I literally took 30 seconds to make it. o_O
cba, too lazy and busy doing other stuff. That's right I'm lazy and busy so wont be participating.
Quote Originally Posted by why06jz View Post
cba, too lazy and busy doing other stuff. That's right I'm lazy and busy so wont be participating.
Busy playing CA, I see.
Posts 115 of 19 · Page 1 of 2
This thread is closed for replies.

Tags for this Thread

None

Need help?