## Problem 135

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

Don't post any spoilers
Marcscol
Posts: 2
Joined: Mon Dec 24, 2007 11:37 am

### Problem 135 is providing wrong informatio

Hi Euler,

I was trying to solve problem 135 at it says that the least value that an equation has exactly two solutions is 27:

34^2 - 27^2 - 20^2 = 12^2 - 9^2 - 6^2 = 27

Trying to solve it I got that 15 has two solutions also:

19^2 - 15^2 - 11^2 = 7^2 - 5^2 - 3^2 = 15

Maybe I'm wrong, maybe I'm doing something wrong, but this is the thing that I've noticed.

Thanks and Regards,

Marcus

xenon
Posts: 63
Joined: Wed Sep 20, 2006 7:09 pm

### Re: Problem 135 is providing wrong informatio

Marcscol
Posts: 2
Joined: Mon Dec 24, 2007 11:37 am

### Re: Problem 135 is providing wrong informatio

Yeah.... After posting, I checked the algo and I saw that I was making a mistake.

Marcus

GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

### Problem 135

I've been looking at problem 135, and seem to be missing something. It states that for n=27, there are only 2 solutions:

342 - 272 - 202 = 27
122 - 92 - 62 = 27

Why aren't others included, such as:

82 - 62 - 12 = 27
102 - 82 - 32 = 27
142 - 122 - 52 = 27
162 - 152 - 22 = 27

I must be missing something in the wording of this problem, but it's not jumping out at me.

~gs2gf

quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

### Re: Am I reading problem 135 wrong?

The numbers have to be part of an arithmetic progression.

i.e. (x+2k)^2 - (x+k)^2 - x^2 = n
ex ~100%'er... until the gf came along.

GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

### Re: Am I reading problem 135 wrong?

Duh, I was completely "reading over" that clause and it just wasn't being noticed. Thanks.

~gs2gf

MaJJ
Posts: 49
Joined: Tue Oct 14, 2008 12:14 am

### Re: Problem 135

If I use quilan's words -

Code: Select all

(x+2k)^2 - (x+k)^2 - x^2 = n
- then my loop stops when k = 578 and
Expand
. Is the latter way off?

The k gives sense:
(1+578+578)^2 - (1+578)^2 - 1^2 = 1338649 - 335241 - 1 = 1003407
(1+577+577)^2 - (1+577)^2 - 1^2 = 1334025 - 334084 - 1 = 999940
- or am I missing something?

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

### Re: Problem 135

kapila_619
Posts: 3
Joined: Mon Jun 27, 2011 2:29 pm
Location: India

### Re: Problem 135

I don't know whether this is a valid question
I think I'm getting my maths wrong somewhere

to find, values of z for which (z+2k)^2-(z+k)^2-z^2=n

f(z,k)=z^2-2zk-3k^2+n //n is const
I have found condition for z>0 to be : k belongs to -sqrt(n)/2 to sqrt(n)/2

but
n=27,x=7,y=20
and
n=27,x=3,y=6

these don't satisfy my obtained conditioned, while they satisfy f(z,k)=0

for n=27, k should belong to -2.598 to 2.598
but k=3,7 satisfy

I know we have to find f(z,k)=0, but the problem says x,y,z>0, so i just applied the condition discriminant<0 to get a range of values of 'k' for a particular 'n'

can u tell me where am I going wrong

thanks

jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: Problem 135

kapila_619 wrote:I have found condition for z>0 to be : k belongs to -sqrt(n)/2 to sqrt(n)/2
I think you have a sign error on the k^2 term of the discriminant. The one I get is always positive (for positive n) so of no use.

Edit: No, I got the sign wrong myself. So you get an expression in k and n for the discriminant. You need that discriminant to be positive for there to be any solutions for z at all. So you need k to lie outside the region you found rather than inside.

lirugeda
Posts: 3
Joined: Tue Jul 19, 2011 6:25 pm

### Re: Problem 135

I found an algorithm to get the answer, but when I put my answer in, it's incorrect. So, I was wondering if someone could help me verify the first 10 values of n which have exactly 10 distinct solutions:

1155
1995
2415
3003
3135
3255
3315
3795
3927
4095

jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: Problem 135

The correct ones are 1155, 3003, 3135 (which are first, 7th and 8th on my list).

xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

### Re: Problem 135

are these the first 3?

[spoiler]1155
1184
1203[/spoiler]

jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: Problem 135

No. The first one is correct, but the others don't have 10 solutions but only two.

xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

### Re: Problem 135

edit: ok thx

I am stuck

xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

### Re: Problem 135

[spoiler]1155
[1155, 1575, 1755, 1920, 2079, 2304, 2475, 2688, 2835, 2880, 3003][/spoiler]

which one of these are wrong?

Tharsis
Posts: 1
Joined: Sat Nov 19, 2011 6:05 pm

### Re: Problem 135

jaap wrote:The correct ones are 1155, 3003, 3135 (which are first, 7th and 8th on my list).
Actually, 3315 is also correct.
xe3tec wrote:[spoiler]1155
[1155, 1575, 1755, 1920, 2079, 2304, 2475, 2688, 2835, 2880, 3003][/spoiler]

which one of these are wrong?
1575, 2475, 2835, and 2880 are not correct.

thkang
Posts: 8
Joined: Thu Nov 15, 2012 8:34 am

### Re: Problem 135

Given the positive integers, x, y, and z, are consecutive terms of an arithmetic progression, the least value of the positive integer, n, for which the equation, x^2 -y^2- z^2 = n, has exactly two solutions is n = 27:

34^2- 27^2- 20^2 = 12^2- 9^2-6^2 = 27

It turns out that n = 1155 is the least value which has exactly ten solutions.

How many values of n less than one million have exactly ten distinct solutions?
I'm having problem with counting N:

let's say we're thinking about arithmetic progression that progresses by 10. since 0<n<1,000,000, here are all the possible cases:

Code: Select all

P||||    X   Y  Z  N
p==10 21 11 1 319
p==10 22 12 2 336
p==10 23 13 3 351
p==10 24 14 4 364
p==10 25 15 5 375
p==10 26 16 6 384
p==10 27 17 7 391
p==10 28 18 8 396
p==10 29 19 9 399
p==10 30 20 10 400
p==10 31 21 11 399
p==10 32 22 12 396
p==10 33 23 13 391
p==10 34 24 14 384
p==10 35 25 15 375
p==10 36 26 16 364
p==10 37 27 17 351
p==10 38 28 18 336
p==10 39 29 19 319
p==10 40 30 20 300
p==10 41 31 21 279
p==10 42 32 22 256
p==10 43 33 23 231
p==10 44 34 24 204
p==10 45 35 25 175
p==10 46 36 26 144
p==10 47 37 27 111
p==10 48 38 28 76
p==10 49 39 29 39
now the problem is I'm having hard time understanding what n I should count.
the least value of the positive integer, n,
I can see that 49, 39, 29 yields least value of n, which is 39.
(and this is trivial without enumerating all x, y, z)

initially, given this observation, I thought what I had to do was:
for p==10, the least value of n is 39, count it once, move along to next p
however, by this method the given example of n=1155 having 10 solutions could not be found.

edit :
disregard everything I wrote.

however I have a question : how could n have a 'least' value? doesn't that term implies there is also a 'most' value and there are more than one possible 'n's for an arithmetic sequence?

TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

### Re: Problem 135

thkang wrote: however I have a question : how could n have a 'least' value? doesn't that term implies there is also a 'most' value and there are more than one possible 'n's for an arithmetic sequence?
If I remember well, in most of the cases least means the smallest number.
By this I mean: let us fix an arbitrary n which is less than 1155. The number of different triplets (x,y,z) for which x^2-y^2-z^2=n for this fixed n, is at most nine, or at least eleven. For n=1155, the number of triplets is exactly ten.

JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

### Re: Problem 135

On this problem, is there a difference between "exactly ten solutions" and "exactly ten distinct solutions?" I found this very confusing since my code is able to get jaap's numbers in the correct order and yet my answer is wrong.