+ 3

[ASSIGNMENT] Challenge: solving Pell like integer quadratic equations

With any given integer n, you need to find all the x and y positive integers so that x**2-4y**2=n Ex for n=90005 there are 4 possible solutions (one of them is (309,37) ) n=90002 there are no solutions Hint: You can use the fact that x**2-4y**2=(x-2y).(x+2y) to deduce possible values for x and y Your program needs to return all the (x,y) solutions for a given n or [ ] if there is no solution (for n=90002 for example).

6th Apr 2018, 6:08 AM
VcC
VcC - avatar
11 Answers
+ 1
It seems there is a solution to n = 90004... https://code.sololearn.com/ch8Jkr5eSf94/?ref=app
6th Apr 2018, 2:14 PM
Russ
Russ - avatar
+ 2
Whoever marked my comment down is awful. This person was demanding "Where is the code?", and showed zero effort to doing ANY work at all.
6th Apr 2018, 2:02 PM
Emma
7th Apr 2018, 3:39 PM
VcC
VcC - avatar
0
@Xan You are missing 2 solutions for 90005. ex 45003,22501
6th Apr 2018, 1:51 PM
VcC
VcC - avatar
0
I've deleted the code because you were too lazy and demanding. Good luck. I've also removed all my helpful comments.
6th Apr 2018, 1:52 PM
Emma
0
Yep sorry. No solution for 90002 not 90004
6th Apr 2018, 3:06 PM
VcC
VcC - avatar
0
@Donna looking for integer number solutions. Very different problem !
13th Apr 2018, 9:39 AM
VcC
VcC - avatar
0
Lucas Pardo It seems you agree with laziness and rudeness Lucas. You're blocked too. Good riddance to mindless people.
13th Apr 2018, 9:45 AM
Emma
0
@Xan I can't understand why you have taken this tone on this thread. Having read through some comments you've made in the last 24 hours, I can see that you're unhappy with a certain type of user expecting you to code for them for no gratitude whatsoever, which is completely understandable, but I don't see how that's applicable here. This was just an assignment (challenge in now-old parlance) where anyone can try and create a code to answer the task, if you wish to participate. If you look through some of OP's codes, you can see that they are perfectly capable of accomplishing this task themselves and not asking anyone to do their homework for them. Maybe there are comments that have been removed causing me to mis-read the situation, but all I saw was OP point out that a code you'd submitted didn't quite fully meet its designed purpose, causing you to react in this way. I don't mean any of this to criticise, but I am finding your stance a little baffling.
13th Apr 2018, 2:55 PM
Russ
Russ - avatar
0
@russ I'm probably in a worse mood than normal because I buried a friend yesterday, who I saw crushed to death. I probably need time out.
13th Apr 2018, 2:57 PM
Emma
0
@Xan I'm really sorry to hear that and I had no idea. Hope you're doing ok. Whatever you need to do, take care dude.
13th Apr 2018, 2:59 PM
Russ
Russ - avatar