+ 12
[challenge] arrange numbers from 1 to 15 for squares
Arrange the numbers form 1 to 15, so that the addition of two adjacent numbers always is a square. Eg: If the numbers were 1,22,99 instead of 1,2,3,...,15 a solution would be 22 99 1 22 + 99 = 121 = 11^2 99+1 = 100 = 10^2 Do it with or without programming but have fun.
10 Antworten
+ 14
@Oma
I have enjoyed solving this challenge. Thanks 😉
+ 5
@Lukar thats it!
+ 4
nice one. 15-liner. note that there are no solutions for some n like n=8
https://code.sololearn.com/c63zI084QR1t/?ref=app
+ 4
+ 3
@vcc you solved it !
+ 3
The solution is very easy if one paints a graph. vertices connect numbers which could be neighbours.
+ 2
yes. you cant brute force it so what the code does is building he graph m then depth searching into it.
+ 2
Funny thing: you cant do it for n=24 but starting with 25 up to 45 (maybe higher) you can do it for any n...