Problem 012
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
- Lord_Farin
- Posts: 239
- Joined: Wed Jul 01, 2009 10:43 am
- Location: Netherlands
Re: Problem 012
After you solve the problem, there will be a PDF icon besides the forum icon. This links to the PDF file.akshayms wrote:Where can i find that PDF

-
m34tcode
- Posts: 4
- Joined: Sun May 22, 2011 8:02 pm
Problem 012
my program(in java) is too slow to find the first factor with over 500 divisors. right now i have two functions, one that finds the triangle number, and one that finds every factor of a number, then returns how many were found.
my triangle function is nearly instant, since it just uses an equation. my factoring function, tests every number less than or equal to the number being factored, and counts how many were perfectly divisible.
does anyone know a quicker way to find how many factors a number has? the current way ios far too slow for large numbers and i cant find the answer in under a minute, as i should be able to.
my triangle function is nearly instant, since it just uses an equation. my factoring function, tests every number less than or equal to the number being factored, and counts how many were perfectly divisible.
does anyone know a quicker way to find how many factors a number has? the current way ios far too slow for large numbers and i cant find the answer in under a minute, as i should be able to.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 012
Please don't start a new topic for a problems if such a topic already exists.

War ruins the life and health of untold numbers of innocent children.
-
davidFashion
- Posts: 14
- Joined: Fri Mar 04, 2011 10:53 pm
Re: Problem 012
A factor is not a divisor. I would suggest reviewing your program to ensure that you are solving the requested problem. A brute force program can solve the problem in a very short time.m34tcode wrote:my program(in java) is too slow to find the first factor with over 500 divisors.
... Other comments removed ...
does anyone know a quicker way to find how many factors a number has?
My solution is in Java and completes in .031 sec.

-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
Re: Problem 012
Factor and divisor are synonyms and mean exactly the same thing.davidFashion wrote:A factor is not a divisor.
To m34tcode - I'm afraid this forum isn't for giving away hints; you'll need to come up with the idea for something faster yourself.
-
davidFashion
- Posts: 14
- Joined: Fri Mar 04, 2011 10:53 pm
Re: Problem 012
Yes, you are correct. When I wrote "factor", I was thinking "prime factor". Thanks for the clarification.TripleM wrote:Factor and divisor are synonyms and mean exactly the same thing.davidFashion wrote:A factor is not a divisor.

-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 012
Yes, there is a faster way, and most of the successful problem 12 solvers probably used it (I know I did).m34tcode wrote:my triangle function is nearly instant, since it just uses an equation. my factoring function, tests every number less than or equal to the number being factored, and counts how many were perfectly divisible.
does anyone know a quicker way to find how many factors a number has?
Your challenge is to find it.

-
akv1kor
- Posts: 4
- Joined: Thu Jun 09, 2011 7:21 pm
Re: Problem 012
Hi, I tried the problem 12,
i got one answer, which seems to be incorrect according to the website.
the number has 24 and 23 divisors each. can anyone give any further hint.
i got one answer, which seems to be incorrect according to the website.
the number has 24 and 23 divisors each. can anyone give any further hint.
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 012
4 has 3 divisors.akv1kor wrote:Hi, I tried the problem 12,
i got one answer, which seems to be incorrect according to the website.
the number has 24 and 23 divisors each. can anyone give any further hint.
6 has 4 divisors.
But...
4*6 = 24 does not have 12 divisors, only 8.

-
akv1kor
- Posts: 4
- Joined: Thu Jun 09, 2011 7:21 pm
Re: Problem 012
Here we have N&N+1 so above logic does not fit i suppose.thundre wrote: 4 has 3 divisors.
6 has 4 divisors.
But...
4*6 = 24 does not have 12 divisors, only 8.
apart from 1,other divisors are mutually exclusive.
my number has 577 divisors,Is this any way near.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 012
Unless I'm mistaken the smallest number having 577 divisors is 2576 (577 is prime).
However, if you multiply two coprime numbers with 23 and 24 divisors the number of divisors would be 23*24=552.
The number you are looking for has 576 divisors.
Do you handle the division by two correctly?
However, if you multiply two coprime numbers with 23 and 24 divisors the number of divisors would be 23*24=552.
The number you are looking for has 576 divisors.
Do you handle the division by two correctly?

War ruins the life and health of untold numbers of innocent children.
-
akv1kor
- Posts: 4
- Joined: Thu Jun 09, 2011 7:21 pm
Re: Problem 012
its my mistake actually i did a mistake in adding 1 as a divisor for the first number.
now the number has 24 and 24 divisors each and i give (n*(n+1))/2 as solution but still i have wrong answer.
***0*1*0 is my value for ****th triangle number. pls match asterik with answers and advice
now the number has 24 and 24 divisors each and i give (n*(n+1))/2 as solution but still i have wrong answer.
***0*1*0 is my value for ****th triangle number. pls match asterik with answers and advice
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 012
I'm not sure what your problem is, but let me give two examples:
suppose n=3, then n+1=4, so n(n+1)/2=6.
6 has 4 divisors: 1,2,3, and 6.
How can I calculate this from 3 and 4?
The numers to multiply are 3 and 4/2=2.
3 has two divisors: 1 and 3, and 2 has two divisors: 1 and 2.
So the number if divisors of 6 is 2*2=4.
If we take n=8 then n+1=9
So we have to multiply 8/2=4 and 9, makes 36.
36 has 9 divisors 1,2,3,4,6,9,12,18 and 36.
4 and 9 have both 3 divisors and 3*3=9.
suppose n=3, then n+1=4, so n(n+1)/2=6.
6 has 4 divisors: 1,2,3, and 6.
How can I calculate this from 3 and 4?
The numers to multiply are 3 and 4/2=2.
3 has two divisors: 1 and 3, and 2 has two divisors: 1 and 2.
So the number if divisors of 6 is 2*2=4.
If we take n=8 then n+1=9
So we have to multiply 8/2=4 and 9, makes 36.
36 has 9 divisors 1,2,3,4,6,9,12,18 and 36.
4 and 9 have both 3 divisors and 3*3=9.

War ruins the life and health of untold numbers of innocent children.
- Francky
- Posts: 90
- Joined: Sat May 07, 2011 3:49 pm
- Location: South of France
Re: Problem 012
2 and 3 are coprime.
4 and 9 are coprime.
It's important !
4 and 9 are coprime.
It's important !
Entia non sunt multiplicanda praeter necessitatem- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 012
Of course, but akv1kor knows that already.

War ruins the life and health of untold numbers of innocent children.
- Francky
- Posts: 90
- Joined: Sat May 07, 2011 3:49 pm
- Location: South of France
Re: Problem 012
Sorry, it was written just before. 
Entia non sunt multiplicanda praeter necessitatem-
akv1kor
- Posts: 4
- Joined: Thu Jun 09, 2011 7:21 pm
Re: Problem 012
thanks HK for your kind advice, you got it correct, i never thought to find factors of n/2
now i got it
now i got it
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 012
You're welcome.akv1kor wrote:thanks HK for your kind advice, you got it correct, i never thought to find factors of n/2
now i got it

War ruins the life and health of untold numbers of innocent children.
-
jkplusplus
- Posts: 1
- Joined: Sat Jul 02, 2011 6:15 pm
Re: Problem 012
Oh man, what a horrible time to forget to write in a pause function at the end of the program!!!!