[Challenge]👮👮👮👮 special number WANTED 👮👮👮👮 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

[Challenge]👮👮👮👮 special number WANTED 👮👮👮👮

Numbers can be written as sum of two squares. example: 5 = 1**2 + 2**2 10 = 3**2 + 1**2 25 = 4**2 + 3**2 Which ist the lowest number that can be written by two squares on four different ways? number = a**2 + b**2 = c**2 + d**2 = e**2 + f**2 = g**2 + h**2 (a,b) ne (c,d) ne (e,f) ne (g,h) // ne = not equal Have fun and send result before 11.may All languages welcome!

21st Nov 2017, 5:16 PM
Oma Falk
Oma Falk - avatar
23 Answers
23rd Nov 2017, 7:30 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 11
https://code.sololearn.com/clyYEl12xtw2/?ref=app
22nd Nov 2017, 4:06 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 10
My late Python code, at least I made it : https://code.sololearn.com/c4JWdYckP7hJ/?ref=app
27th Nov 2017, 6:50 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 10
@justine and you made it right too
27th Nov 2017, 7:01 PM
Oma Falk
Oma Falk - avatar
+ 8
🙌🙌🙌Yahhhh!!!!!!
27th Nov 2017, 7:05 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 6
The number is 96. I'll send my code later. Batman!! Is 96 the answer??
21st Nov 2017, 9:17 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 6
sorry, it's 192, I'll post my code
21st Nov 2017, 10:01 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 5
@christian if this is dirty, what is clean? winkt jeder Wirtschaftsprüfer durch
21st Nov 2017, 10:10 PM
Oma Falk
Oma Falk - avatar
+ 5
hey, guys very sorry. I made a mistake. your correct
21st Nov 2017, 10:27 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 5
@sayan it cant be 5. you need 8 different numbers. 1..8 is not possible since 1**2 + 8**2 > 2**2 + 7**2 1**2 + 9**2 > 3**2 + 8**2 9 not possible 1**2 + 10**2 > 4**2 + 9**2 10 even not possible
22nd Nov 2017, 7:21 AM
Oma Falk
Oma Falk - avatar
+ 4
@Batman: muss ja, bin doch Steuerberater 😀 I think it would be cleaner when it would do less iterations, for example it should stop when the counter for a number reaches 4. Also the limit increases arbitrarily and then the previous iterations are repeated. But at least it is easy to read 😁
21st Nov 2017, 10:36 PM
Cristian Stollberg
Cristian Stollberg - avatar
+ 4
@cristian but there are already some ideas 10**2 is the lowest higher summand one should think about.
21st Nov 2017, 10:46 PM
Oma Falk
Oma Falk - avatar
+ 4
@sayan lowest possible higgest summand
22nd Nov 2017, 7:11 AM
Oma Falk
Oma Falk - avatar
+ 3
ok....heres my py code ##/ No module/## ## my code gives you 1st 20 numbers.. @@ note @@ BATMAN AND CRISTIAN LOWEST HIGHER SUMMAND IS 5 https://code.sololearn.com/cXZ0SN1Hxx62/?ref=app
22nd Nov 2017, 5:28 AM
sayan chandra
sayan chandra - avatar
+ 3
@sayan: if you would have to change the parameters to get the lowest number that can be written by two squares on FIVE different ways, what number would your algorithm generate? And how many seconds would it need? Mine found it in 0.0-0.02 (I ran it couple of times and got values in this range).
22nd Nov 2017, 9:07 AM
Cristian Stollberg
Cristian Stollberg - avatar
21st Nov 2017, 7:44 PM
yuri
+ 2
also dirty, but without extra modules https://code.sololearn.com/cv7qmpc9L8Nx/
21st Nov 2017, 9:38 PM
Cristian Stollberg
Cristian Stollberg - avatar
+ 1
yes its 5... calculating from 10... u can at most increase the number by 5 to get consecutive correct quad_square-pairs
22nd Nov 2017, 7:14 AM
sayan chandra
sayan chandra - avatar
+ 1
see my logic ...my code
22nd Nov 2017, 7:22 AM
sayan chandra
sayan chandra - avatar
+ 1
@@ note for 1st number that we have supppos its 10.. it got 4 different pairs.. now whenever u do +5 the total number of numbers is increasing any way... 15--20--25..... u got sufficient 4 different pairs.. if u increse it each time by other than 5..u will get wrong consecutive correct output... if u generate 30 ...such numbers u will not get the first 30...
22nd Nov 2017, 7:41 AM
sayan chandra
sayan chandra - avatar