login
First column of square array A082025.
4

%I #19 Feb 19 2020 07:21:51

%S 1,3,4,9,8,27,14,39,22,57,32,81,46,105,64,147,82,189,104,225,124,273,

%T 142,315,166,345,194,375,224,465,254,525,286,615,326,705,358,777,394,

%U 855,434,939,470,1023,524,1113,572,1233,620,1329,668,1395,722,1545,782

%N First column of square array A082025.

%p b:= proc(t) option remember; false end: b(1):= true: ncpr:= proc() local i, m; m:= args[1]; for i from 2 to nargs do if igcd (m, args[i])<>1 then return true fi od; false end: T:= proc(n,k) option remember; local h, t, l; if n<1 or k<1 or n=1 and k=1 then t:=1 else h:= 1- 2* irem(n+k, 2); l:= T(n-1, k), T(n, k-1), T(n-1, k-1), T(n+h, k-h); for t while b(t) or ncpr(t, l) do od fi; b(t):= true; t end: seq(T(n,1), n=1..60); # _Alois P. Heinz_, Oct 07 2009

%t nmax = 55; a[1, 1] = 1; used = {1}; a[_, _] = 1;

%t loop := For[i = n-j+1; k = 1, True, k++, If[FreeQ[used, k] && AllTrue[ {a[i-1, j+1], a[i-1, j], a[i-1, j-1], a[i, j-1], a[i+1, j-1]}, CoprimeQ[k, #]&], AppendTo[used, k]; a[i, j] = k; Break[]]];

%t Do[If[EvenQ[n], Do[loop, {j, n, 1, -1}], Do[loop, {j, 1, n}]], {n, 2, nmax}];

%t a[n_] := a[n, 1];

%t Array[a, nmax] (* _Jean-François Alcover_, Feb 19 2020 *)

%Y Cf. A082025, A082187, A082189, A082190.

%K nonn

%O 1,2

%A _Amarnath Murthy_, Apr 07 2003

%E More terms from _R. J. Mathar_, May 06 2006

%E Edited with further terms by _Alois P. Heinz_, Oct 07 2009