Problem 379

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.
Post Reply
dranzer
Posts: 1
Joined: Sat Apr 07, 2012 4:44 pm

Problem 379

Post by dranzer »

Hello,
I had a question about this. If I got it right, to find

f(n)
I would have to find the number of pairs (x,y), such that x&Y are positive integers, x<=y and LCM(x,y) == n.
But doesn't this give an infinite number of ways ?

For example, if I am trying to find f(2), can't x&y be any pair of even numbers ( with x<=y ) ?
(2,2) (2,4) (4,8) ...... ( 2x, 4x ) .... etc.

Or maybe I misunderstood some part of the question ?
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 379

Post by hk »

LCM(2,4)=4 and LCM(4,8)=8.
Image
War ruins the life and health of untold numbers of innocent children.
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 379

Post by thundre »

Don't confuse LCM with GCF.

If LCM(x,y) = n, y must be a factor of n, making n a multiple of y.
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 379

Post by hk »

Yes that's true.
But also GCD(4,8)=4 and not 2 and GCD(2x,4x)=2x.
As LCM(a,b)=a*b/(GCD(a,b), it follows that LCM(2x,4x)=2x*4x/2x=4x.
Image
War ruins the life and health of untold numbers of innocent children.
stevcis
Posts: 3
Joined: Fri Apr 13, 2012 6:41 am

Re: Problem 379

Post by stevcis »

sorry... it is deleted.
Last edited by stevcis on Fri Apr 13, 2012 1:59 pm, edited 3 times in total.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 379

Post by hk »

@ stevcis:
this forum isn't a place to discuss solution methods.
Could you be so kind to remove your post?
Image
War ruins the life and health of untold numbers of innocent children.
william2a
Posts: 5
Joined: Sun Oct 19, 2008 11:00 am

Problem 379

Post by william2a »

"Somewhere things get wrong"

For g(104 I get 363,982 that's right.
For g(106) I get 73,858,790 which is equal to (2*37,429,395)-106.

I am unable to see where is my mistake.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 379

Post by hk »

Please don't start a new topic if there already exists one for that problem.
Image
War ruins the life and health of untold numbers of innocent children.
stevcis
Posts: 3
Joined: Fri Apr 13, 2012 6:41 am

Re: Problem 379

Post by stevcis »

@william 2a

how do you know g(10^4) is 363982 if g(10^6) is wrong and the only hint we're given from PE is for 10^6???
william2a
Posts: 5
Joined: Sun Oct 19, 2008 11:00 am

Re: Problem 379

Post by william2a »

@hk: Sorry.

I found the first ten values (1, 3, 3, 5, 3, 9, 3, 7, 5, 9) by brute forcing.

These values gave me the A048691 sequence in OEIS where I found a link to the first 104 values.

A little program in PARI gave me the sum of these values.
stevcis
Posts: 3
Joined: Fri Apr 13, 2012 6:41 am

Re: Problem 379

Post by stevcis »

@ WILLIAM 2a

i'd look carefully at those first 10 values... if your sequence means that 1 is the LCM for 1 pair, 2 is the LCM for 3 pairs, 3 is the LCM for 3 pairs, 4 is the LCM for 5 pairs, then i think careful examination of just the number 2 would suggest there is something wrong with the brute force algorithm.
i get 1,2,2,3,2,5,2,4,3,5 which is the same as yours except your 3s are 2s, your 5s are 3s, your 9s are 5s and your 7s are 4s.

f(10,000) should be 186993 according to my algorithm which correctly gets g(10^6).

btw i have no idea how to solve the actual question but i do get g(10^6). 10^12 is just a darn big number :-(
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 379

Post by thundre »

william2a wrote:"Somewhere things get wrong"

For g(104 I get 363,982 that's right.
For g(106) I get 73,858,790 which is equal to (2*37,429,395)-106.

I am unable to see where is my mistake.
Did you notice the constraint "x ≤ y"? I think your numbers are "right" if you ignore that.
Image
william2a
Posts: 5
Joined: Sun Oct 19, 2008 11:00 am

Re: Problem 379

Post by william2a »

@stevcis

Many thanks for your help.
I continue my search.
Perlkonig
Posts: 5
Joined: Tue Aug 21, 2012 3:31 pm

Re: Problem 379

Post by Perlkonig »

stevcis wrote: f(10,000) should be 186993 according to my algorithm which correctly gets g(10^6).
Ack! I get 186991! No idea how I'm going to debug that!

*sighs*
Perlkönig
Post Reply