← RoseCode

ROSECODE 114

A special order

sinan · Programming ·

Order the numbers 1 to 66 in such a way that sum of any 2 consecutive numbers is a square number. In case there are multiple solutions, find the lexicographically first solution. Answer format: concatenate every 5th number starting with the 1st. (i.e: 1st,6th,11th,...,66th) Example: 831116 for 1 to 16 (8,1,15,10,6,3,13,12,4,5,11,14,2,7,9,16)