+ 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!
23 Answers
+ 5
My try with generators:
https://code.sololearn.com/c5IGm0DwpEIf/?ref=app
+ 11
https://code.sololearn.com/clyYEl12xtw2/?ref=app
+ 10
My late Python code, at least I made it :
https://code.sololearn.com/c4JWdYckP7hJ/?ref=app
+ 10
@justine and you made it right too
+ 8
🙌🙌🙌Yahhhh!!!!!!
+ 6
The number is 96.
I'll send my code later.
Batman!! Is 96 the answer??
+ 6
sorry, it's 192, I'll post my code
+ 5
@christian if this is dirty, what is clean?
winkt jeder Wirtschaftsprüfer durch
+ 5
hey, guys very sorry. I made a mistake. your correct
+ 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
+ 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 😁
+ 4
@cristian but there are already some ideas
10**2 is the lowest higher summand one should think about.
+ 4
@sayan lowest possible higgest summand
+ 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
+ 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).
+ 2
dirty, but works ;(
https://code.sololearn.com/c5FZ3ISza2bx/?ref=app
+ 2
also dirty, but without extra modules
https://code.sololearn.com/cv7qmpc9L8Nx/
+ 1
yes its 5...
calculating from 10...
u can at most increase the number by 5 to get consecutive correct quad_square-pairs
+ 1
see my logic ...my code
+ 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...