Problem 012

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
akshayms
Posts: 1
Joined: Sat May 14, 2011 3:24 pm

Re: Problem 012

Post by akshayms »

Where can i find that PDF
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Problem 012

Post by Lord_Farin »

akshayms wrote:Where can i find that PDF
After you solve the problem, there will be a PDF icon besides the forum icon. This links to the PDF file.
Image
m34tcode
Posts: 4
Joined: Sun May 22, 2011 8:02 pm

Problem 012

Post by m34tcode »

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.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 012

Post by hk »

Please don't start a new topic for a problems if such a topic already exists.
Image
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

Post by davidFashion »

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?
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.

My solution is in Java and completes in .031 sec.

Image
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 012

Post by TripleM »

davidFashion wrote:A factor is not a divisor.
Factor and divisor are synonyms and mean exactly the same thing.

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

Post by davidFashion »

TripleM wrote:
davidFashion wrote:A factor is not a divisor.
Factor and divisor are synonyms and mean exactly the same thing.
Yes, you are correct. When I wrote "factor", I was thinking "prime factor". Thanks for the clarification.

Image
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 012

Post by thundre »

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?
Yes, there is a faster way, and most of the successful problem 12 solvers probably used it (I know I did).

Your challenge is to find it.
Image
akv1kor
Posts: 4
Joined: Thu Jun 09, 2011 7:21 pm

Re: Problem 012

Post by akv1kor »

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.
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 012

Post by thundre »

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.
4 has 3 divisors.
6 has 4 divisors.

But...
4*6 = 24 does not have 12 divisors, only 8.
Image
akv1kor
Posts: 4
Joined: Thu Jun 09, 2011 7:21 pm

Re: Problem 012

Post by akv1kor »

thundre wrote: 4 has 3 divisors.
6 has 4 divisors.

But...
4*6 = 24 does not have 12 divisors, only 8.
Here we have N&N+1 so above logic does not fit i suppose.
apart from 1,other divisors are mutually exclusive.
my number has 577 divisors,Is this any way near.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 012

Post by hk »

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?
Image
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

Post by akv1kor »

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
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 012

Post by hk »

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.
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
Francky
Posts: 90
Joined: Sat May 07, 2011 3:49 pm
Location: South of France

Re: Problem 012

Post by Francky »

2 and 3 are coprime.
4 and 9 are coprime.
It's important !
ImageEntia non sunt multiplicanda praeter necessitatem
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 012

Post by hk »

Of course, but akv1kor knows that already.
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
Francky
Posts: 90
Joined: Sat May 07, 2011 3:49 pm
Location: South of France

Re: Problem 012

Post by Francky »

Sorry, it was written just before. :oops:
ImageEntia non sunt multiplicanda praeter necessitatem
akv1kor
Posts: 4
Joined: Thu Jun 09, 2011 7:21 pm

Re: Problem 012

Post by akv1kor »

thanks HK for your kind advice, you got it correct, i never thought to find factors of n/2
now i got it
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 012

Post by hk »

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
You're welcome.
Image
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

Post by jkplusplus »

Oh man, what a horrible time to forget to write in a pause function at the end of the program!!!!
Post Reply