4 has the property that if one adds it to double its square, it yields a perfect square. In other words for natural numbers m , n :
n 2 + n 2 + n = m 2
There are four such n < 1 0 6 . If 4 is the smallest n , what is the second smallest n ?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Excellent way to manipulate equations
how did you get the remaining solutions from the base solution
Log in to reply
Expand the equation, x k + y k n = ( x 1 + y 1 n ) k . You can read the wiki that is attached to this problem as well.
Log in to reply
How can you determine other values by using the base values
Log in to reply
@Hari Rahul – The wiki made it pretty clear. I want to find positive integer solutions for 1 = X 2 − 8 Y 2 .
There is a mistake in step 3
It reduces to n(2n+1)=m^2. now from here it is clear that n must be a perfect square. so it becomes a Pell's Equation that b^2- 2 .a^2=1.,whose initial solutions are (b,a)=(3,2) where n=a^2 and m/n=b. the other solutions are given by (p,q) where (3+2 /2)^2=p+q /2,hence the next immediate solution is 2.3.2=12. Thank You
1 2 3 4 5 6 |
|
Python code
wolfram alpha input
solve 2n^2+n=m^2, 4<=n<10^6, m>0
= 4, 144, 4900, 166464
Mathematica:
Solve[2 n^2 + n == m^2 && 0 < n < m < 1000000, {n, m}, Integers]
{{n -> 4, m -> 6}, {n -> 144, m -> 204}, {n -> 4900, m -> 6930}, {n -> 166464, m -> 235416}}
Here is a solution without Pell's using modular arithmetic.
It is clear n = 0 , 3 m o d 4 . We show n = 3 m o d 4 fails. Let n = 4 k + 3 and then ( 4 k + 3 ) ( 8 k + 7 ) = m 2 . Since ( 4 k + 3 ) is not a perfect square this implies g c d ( 4 k + 3 , 8 k + 7 ) > 1 which by Euclid is false, contradiction. So let n = 4 k and so 4 k ( 8 k + 1 ) . We have k ( 8 k + 1 ) a perfect square. By Euclid g c d ( k , 8 k + 1 ) = 1 so k is a perfect square. Simple testing gives us k = 1 , k = 3 6 as the smallest working solutions. We see n = 4 ⋅ 3 6 = 1 4 4 .
I did trial and error. :v
When I originally came up with the problem, I showed n had to be a perfect square and, as such, found the next solution pretty quickly. I'd narrowed down my possible values but it was still trial and error.
I'm glad I didn't ask for the fourth value of n with this property.
Well, at least you've been surprised when you tried 18...
I did that too :D
Multiply both sides of the equation by 8, so we can complete the square on the LHS (left hand side) using integer coefficients: 2 n 2 + n = m 2 ⋅ 8 ⇔ ( 4 n + 1 ) 2 − 1 = 2 ( 2 m ) 2 ⇔ x 2 − 2 y 2 = 1 ∣ x : = 4 n + 1 > 0 , y : = 2 m ≥ 0 The vector x : = ( x , y ) T satisfies Pell's equation, the non-negative solutions are x k : = ( x k , y k ) T . The trivial solution is x 0 = ( 1 ; 0 ) T . Use continued fractions or simply guess the fundamental solution x 1 = ( 3 ; 2 ) T to get all other positive solutions x k in increasing order: x = ( ± x k ± y k ) , x k + 1 = ( 3 2 4 3 ) x k , x 0 = ( 1 0 ) We don't care about non-positive solutions, so we only need to consider x = x k with k > 0 . Of those, only the ones that satisfy the condition " x k m o d 4 = 1 " lead to integer values for n . In iteration k = 4 we find the second smallest n ∈ N : k x k y k m n 1 3 2 1 2 1 7 1 2 6 4 3 9 9 7 0 3 5 4 5 7 7 4 0 8 2 0 4 1 4 4 ⋯
Rem.: With the recurrence relation for x k , it's possible to show that the relevant solutions with " x k m o d 4 = 1 " are exactly the solutions with even k = 2 K > 0 .
Assume that for a given prime p , n is written as n = a p t , where p does not divide a .
We have 2 n 2 + n = 2 a 2 p 2 t + a p t = p t ( 2 a p t + a ) . We see that this expression is divisible by p t , but not by p t + 1 .
Since It is equal to the perfect square m 2 , t must be even, and since this is the case for any p , n must be a perfect square.
We set n = k 2 .
We now have 2 k 4 + k 2 = m 2 so that m must be a multiple of k
2 k 2 + 1 = ( k m ) 2 = u 2 . We see that u is odd.
2 k 2 = ( u + 1 ) ( u − 1 ) is a multiple of 4, so k must be even. Set k = 2 v to find
8 v 2 + 1 = u 2
Now try a few values for v and see if 8 v 2 + 1 is a perfect square:
v | 8 v 2 + 1 | square? | u | n = 4 v 2 | m = 2 v u |
1 | 9 | yes | 3 | 4 | 6 |
2 | 33 | no | |||
3 | 73 | no | |||
4 | 129 | no | |||
5 | 201 | no | |||
6 | 289 | yes | 17 | 144 | 204 |
Check: 2 × 1 4 4 2 + 1 4 4 = 4 1 6 1 6 = 2 0 4 2 So we find n = 1 4 4
We could narrow the search further down by modular arithmetic: For example, if v ≡ 2 ( m o d 5 ) then 8 v 2 + 1 ≡ 3 which is not in the set of squares { 0 , 1 , 4 } ( m o d 5 ) .
We find the conditions v ∈ { 0 , 1 , 4 } ( m o d 5 ) v ∈ { 0 , 1 , 6 } ( m o d 7 ) v ∈ { 0 , 1 , 2 , 5 , 6 , 9 , 1 0 } ( m o d 1 1 ) v ∈ { 0 , 1 , 4 , 6 , 7 , 9 , 1 2 } ( m o d 1 3 ) disqualifying over 90% of the candidates for v .
Remaining candidates to check are then: v ∈ { 1 , 6 , 3 5 , 1 0 4 , 1 2 6 , 1 3 4 , 1 5 5 , 1 6 0 , 1 7 6 , 1 8 1 , 1 8 9 , 2 0 4 , . . . } of which 8 v 2 + 1 is a square for v ∈ { 1 , 6 , 3 5 , 2 0 4 , . . . }
Remark: 0 is not considered a natural number in this problem, otherwise n = 0 would have been the smallest solution.
Here is a solution without using the information of 4 being the smallest n ,
2 n 2 + n = m 2 ⇒ m = n 2 n + 1
This implies that n and 2 n + 1 are a perfect squares.
Since 2 n + 1 is a perfect square, let 2 n + 1 = k 2 , k ∈ Z .
k 2 is obviously odd. Therefore, k must be odd.
2 n + 1 = k 2 ⇒ 2 n = ( k + 1 ) ( k − 1 ) .
Since k is odd, k + 1 and k − 1 must be even. Therefore, n must be even.
Since n is an even perfect square, let n = 4 u 2 , u ∈ Z .
Therefore, 2 n + 1 = k 2 ⇒ 2 ( 4 u 2 ) + 1 = k 2
Finally we end up with a classic Pell's equation: 1 = k 2 − 8 u 2 .
Solving the Pell's equation, the three smallest solutions ( k , u ) are ( 1 , 0 ) , ( 3 , 1 ) , ( 1 7 , 6 ) .
Therefore, the three smallest values of n which satisfy 2 n 2 + n = m 2 are n = 0 (if you consider 0 a perfect square), n = 4 (given in the question), n = 1 4 4 .
If you put m = n + k, you get:
n^2 - n(2k - 1) - k^2 = 0
The discriminant equals (2k - 1)^2 + 4k^2, which means
(2k - 1)^2 + (2k)^2 = E^2, where E is an integer.
The solution is easy to obtain using Euclid's formula for Pythagorean triplets (since (2k - 1) and 2k are consecutive integers), but I was way too lazy to do that so I just checked the list of the first few Pythagorean triples and found (119, 120, 169).
2k = 120, k = 60
n^2 - 119n - 3600 = 0
n = 144
Interesting idea - but if you multiply your discriminant by 2 to combine the two squares in k , you end up with Pell's equation again: 2 E 2 = 2 ( 2 k − 1 ) 2 + 2 ( 2 k ) 2 = ( 4 k − 1 ) 2 + 1 → x 2 − 2 E 2 = − 1 , x : = 4 k − 1
using namespace std; int main() { long a,q; float s; for(a=0;a<=1000;a++) { q=a+2*(pow(a,2)); s=sqrt(q); if(s==floor(s)) cout<<a<<"\n"; } return 0; }
n^2 + n^2 + n =n( 2 n +1 ) = m^2, so n is perfect square and n can divided by 2, so 2 n +1 is perfect square and m is can't divided by 2, due n is perfect square so 2 n +1 can be change to 2 a^2 +1 = b^2 , so (b+1)(b-1)= 2 a^2 ,so we get a is 2, 12 , etc so the smallest two is 12 and we get n is 144, thank you
How do you get a=12, by trial and error?
Problem Loading...
Note Loading...
Set Loading...
Pell's equation:
m 2 4 m 2 1 6 m 2 2 1 = = = = = = = = = 2 n 2 + n 8 n 2 + 4 n 2 ( ( 2 n + 1 ) 2 − ( 2 n + 1 ) ) , let p = 2 n + 1 2 p 2 − p 2 ( 4 p 2 − 2 p ) 2 ( ( 2 p − 1 ) 2 − 1 ) 2 ( 2 p − 1 ) 2 − 1 6 m 2 ( 2 p − 1 ) 2 − 8 m 2 ( 4 n + 1 ) 2 − 8 ( m 2 )
Knowing the two initial values n 1 = 4 ⇒ m 1 = 6 , we get the following pairs of ( n , m ) less than 1 0 6 : ( 1 4 4 , 2 0 4 ) , ( 4 9 0 0 , 6 9 3 0 ) , ( 1 6 6 4 6 4 , 2 3 5 4 1 6 )
The second smallest n is 1 4 4