Problem 388

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
tpgettys
Posts: 4
Joined: Wed May 09, 2012 5:18 am

Problem 388

Post by tpgettys »

From the origin O(0,0,0) all lines are drawn to the other lattice points.
Let D(N) be the number of distinct such lines.
What is meant by "distinct"? I presume it means lines with different "slopes", but two overlapping line segments with different end-points could certainly be considered distinct.
LarryBlake
Posts: 100
Joined: Sat Aug 29, 2009 8:49 pm

Re: Clarification on problem 388

Post by LarryBlake »

It says lines, not segments. Only 1 line goes through 0,0,0 and 1,1,1. The same line also goes through 2,2,2.
Image
Grigorenko
Posts: 1
Joined: Sun Jun 10, 2012 1:19 am

Re: Clarification on problem 388

Post by Grigorenko »

For example, if D(10^10)=111111111............222222222, then is correct answer 111111111222222222 ? Thank you.
User avatar
Marcus_Andrews
Administrator
Posts: 1637
Joined: Wed Nov 09, 2011 5:23 pm

Re: Clarification on problem 388

Post by Marcus_Andrews »

Yes, that's correct. The answer is 18 digits long (no spaces). It's just the first 9 digits immediately followed by the last 9 digits.
Grigorenko wrote:For example, if D(10^10)=111111111............222222222, then is correct answer 111111111222222222 ? Thank you.
EKG
Posts: 3
Joined: Fri Jun 17, 2011 9:25 pm

Re: Problem 388

Post by EKG »

To clarify the problem would D(1) = 7 or something else?
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 388

Post by thundre »

EKG wrote:To clarify the problem would D(1) = 7 or something else?
I guess it's OK to answer since they gave D(1000000) in the problem.

Yes, D(1) = 7.
Image
janardhanan
Posts: 3
Joined: Wed Jul 22, 2009 12:23 pm

Re: Problem 388

Post by janardhanan »

Someone please confirm this.
D(100) = 850957

Just want to make sure whether I am going in right direction or not :)
EKG
Posts: 3
Joined: Fri Jun 17, 2011 9:25 pm

Re: Problem 388

Post by EKG »

So I've been thinking about this problem for a couple of days now. Solutions that I've come up with would definitely cause me to run out of memory and/or not finish in my lifetime. Even an O(n) algorithm that goes from 0 to 1010 would be pretty expensive in terms of time. From looking at the problem it seems to be related to composite numbers and GCDs. However, my basic knowledge in number theory will not do very well in terms helping me to find a solution for the problem. Could anyone point out some specific areas of number theory that would be worth looking into? Perhaps a simpler problem that this one builds on?

Thanks,

EKG
User avatar
hk
Administrator
Posts: 12842
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 388

Post by hk »

I think you can answer this question by yourself.
Hint: GCD is sometimes called HCF.
Which problem(s) you solved mention(s) that term?
(No need to answer here.)
(A more explicit hint: the problem I have in mind has a nice PDF with a sublinear algoritm that many solvers of this problem used.
There is little needed to adapt the algoritm from that PDF to this problem.
I looked it up and you've solved that one indeed.
)
Image
War ruins the life and health of untold numbers of innocent children.
EKG
Posts: 3
Joined: Fri Jun 17, 2011 9:25 pm

Re: Problem 388

Post by EKG »

Thanks hk! Will look into it!
snapey1979
Posts: 5
Joined: Thu Mar 01, 2012 1:11 pm

Re: Problem 388

Post by snapey1979 »

Thanks for the hint hk. I have an algorithm which does 10^6 in half a second and gets to 10^8 before it gives up. I think I know the problem you have in mind, so I'll go and have a look and see if I can expand mine.
browni3141
Posts: 18
Joined: Thu Jan 20, 2011 2:06 am

Re: Problem 388

Post by browni3141 »

I had the same problem as the OP. I think that the words "from" and "to" imply endpoints (at least for me they did). Also, something else seems weird about the wording, but I can't put my finger on it.
Image
Post Reply