+ 5

👑Challenge: Which Integer has the largest number of divisors?👑

Which integer between 1 and 10000 has the largest number of divisors, and how many divisors does it have? Write a program to find the answers and print out the results. It is possible that several integers in this range have the same, maximum number of divisors. Your program only has to print out one of them.

29th Sep 2017, 10:32 AM
Avi Rzayev
Avi Rzayev - avatar
7 Respuestas
+ 12
7560 AND 9240 with count of 64 divisors (including 1 and the number itself) * if getting time limit exceeded error, try again, it might fail from time to time due to a lot of computations * will try to see if i can optimize it further edit: optimized by limiting each loop which count number of divisors of n to sqrt(n) + 1 which greatly improves the run time by doing so, i am basically "losing" half of my results as for divisor 'm' which produce the result: n / m = c there is also c as a divisor which produces: n / c = m which i fail to check because c > sqrt(n) and therefore not included in the initial count check hence the amount of results should be multiplied by 2 * code should run smoothly for n = 10000 * might get time limit exceeded for n = 100000 but should work sometimes edit: added prettified printing of the results https://code.sololearn.com/cK2Hq72gTuip/?ref=app
29th Sep 2017, 11:14 AM
Burey
Burey - avatar
+ 8
https://code.sololearn.com/cI2GkoIpMEld/#cs
30th Sep 2017, 2:10 PM
Vukan
Vukan - avatar
+ 7
29th Sep 2017, 5:13 PM
Podretyz
Podretyz - avatar
29th Sep 2017, 10:58 AM
Calviղ
Calviղ - avatar
+ 4
Here is my try with java: https://code.sololearn.com/cQtOg5ZsDK8N
29th Sep 2017, 12:22 PM
Avi Rzayev
Avi Rzayev - avatar
30th Sep 2017, 2:46 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
1st Oct 2017, 12:36 PM
Paul
Paul - avatar