
EXAMPLE

a(0) = 1 as 1 has no common factor > 1 with its neighbouring four squares.
a(1) = 3 as stepping right one step from 3 leads to 12 which shares the common factor 3.
a(2) = 30 as stepping right two steps from 30 leads to 55 and 88 which share the common factors 5 and 11 respectively.
a(3) = 1235 as stepping right three steps from 1235 leads to 1380, 1533, 1694 which share the common factors 5, 3, 7 respectively.
a(4) = 2439 as stepping right four steps from 2439 leads to 2640, 2849, 3066, 3291 which share the common factors 3, 11, 7, 3 respectively.
a(5) = 90000 as stepping upward five steps from 90000 leads to 91203, 92414, 93633, 94860, 96095 which share common factors 3, 7, 23, 3, 5 respectively.
a(6) = 88805 as stepping upward one step from 88805 leads to 90000, which shares a common factor 5, and then continues upwards with the same five steps as a(5).
a(7) = 4330458 as stepping downward seven steps from 4330458 leads to 4338785, 4347120, 4355463, 4363814, 4372173, 4380540, 4388915 which share common factors 11, 5, 3, 7, 13, 3, 5 respectively.
a(8) = 4322139 as stepping downward one step from 4322139 leads to 4330458, which shares a common factor 3, and then continue downward with the same seven steps as a(7).
a(9) = 22001763 as stepping downward nine steps from 22001763 leads to 22020530, 22039305, 22058088, 22076879, 22095678, 22114485, 22133300, 22152123, 22170954 which share common factors 7, 5, 3, 19, 11, 3, 5, 7, 3 respectively.
a(10) = 21983004 as stepping downward one step from 21983004 leads to 22001763, which shares a common factor 3, and then continue downward with the same nine steps as a(9).
a(11) = 1868098088 as stepping upward eleven steps from 1868098088 leads to 1868270979, 1868443878, 1868616785, 1868789700, 1868962623, 1869135554, 1869308493, 1869481440, 1869654395, 1869827358, 1870000329 which share common factors 23, 3, 7, 5, 3, 11, 13, 3, 5, 7, 3 respectively.
a(12) = 2436807593 as stepping left twelve steps from 2436807593 leads to 2437005054, 2437202523, 2437400000, 2437597485, 2437794978, 2437992479, 2438189988, 2438387505, 2438585030, 2438782563, 2438980104, 2439177653 which share common factors 11, 3, 7, 5, 3, 23, 13, 3, 5, 7, 3, 11 respectively.
