+ 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.

27th Jan 2018, 4:32 PM
Oma Falk
Oma Falk - avatar
10 Answers
27th Jan 2018, 8:40 PM
LukArToDo
LukArToDo - avatar
+ 14
@Oma I have enjoyed solving this challenge. Thanks 😉
27th Jan 2018, 9:00 PM
LukArToDo
LukArToDo - avatar
+ 5
@Lukar thats it!
27th Jan 2018, 8:58 PM
Oma Falk
Oma Falk - avatar
+ 4
nice one. 15-liner. note that there are no solutions for some n like n=8 https://code.sololearn.com/c63zI084QR1t/?ref=app
28th Jan 2018, 8:22 AM
VcC
VcC - avatar
28th Jan 2018, 8:35 AM
VcC
VcC - avatar
+ 3
@vcc you solved it !
28th Jan 2018, 8:27 AM
Oma Falk
Oma Falk - avatar
+ 3
The solution is very easy if one paints a graph. vertices connect numbers which could be neighbours.
28th Jan 2018, 8:29 AM
Oma Falk
Oma Falk - avatar
+ 2
yes. you cant brute force it so what the code does is building he graph m then depth searching into it.
28th Jan 2018, 8:36 AM
VcC
VcC - avatar
+ 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...
28th Jan 2018, 8:16 PM
VcC
VcC - avatar
28th Jan 2018, 1:41 PM
Mister ZioƂo
Mister ZioƂo - avatar