|
Search: id:A082025
|
|
|
| A082025 |
|
Square array of distinct positive integers, in which neighboring entries (both orthogonal and diagonal) are coprime. The array is read by antidiagonals, alternating upwards and downwards. Each entry is the smallest positive integer not already used that is coprime to all of the neighboring entries that are earlier in the sequence. |
|
+0 5
|
|
| 1, 2, 3, 4, 5, 7, 6, 11, 13, 9, 8, 17, 12, 19, 23, 10, 29, 25, 31, 35, 27, 14, 37, 16, 41, 18, 43, 21, 20, 47, 49, 53, 15, 59, 55, 39, 22, 61, 24, 67, 26, 71, 30, 73, 33, 28, 79, 77, 83, 45, 89, 65, 97, 85, 57, 32, 91, 36, 101, 34, 103, 38, 107, 40, 109, 51, 44, 95, 63, 113
(list; table; graph; listen)
|
|
|
OFFSET
|
1,2
|
|
|
EXAMPLE
|
1 2 7 6 23 10 ...
3 5 11 19 ...
4 13 12 ...
9 17 ...
8 ...
...
T(2,2) = 5 and its neighbors are 1, 2, 7, 11, 12, 13, 4 and 3, which are all coprime to 5.
|
|
MAPLE
|
iscoprime := proc(n, m) if gcd(n, m)=1 then RETURN(true); else RETURN(false); fi; end:
isin := proc(a, n, nmax) for row from 1 to nmax do for col from 1 to nmax do if a[row, col] = n then RETURN(true); end; od; od; RETURN(false); end:
iscoprMat := proc(a, candid, row, col, up) if not iscoprime(candid, a[row, col-1]) then RETURN(false); fi; if not iscoprime(candid, a[row-1, col]) then RETURN(false); fi; if not iscoprime(candid, a[row-1, col-1]) then RETURN(false); fi; if up then if not iscoprime(candid, a[row+1, col-1]) then RETURN(false); fi; else if not iscoprime(candid, a[row-1, col+1]) then RETURN(false); fi; fi; RETURN(true); end:
find := proc(a, row, col, nmax, up) for candid from 1 to 5000000 do if isin(a, candid, nmax) then next; fi; if not iscoprMat(a, candid, row, col, up) then next; fi; a[row, col] := candid; RETURN(a[row, col]); od; RETURN(-1); end:
nmax := 15; for row from 1 to nmax do for col from 1 to nmax do a[row, col] := -1; od : od : a[1, 1]:= 1 : up := false:
for dia from 2 to nmax do if up then for col from 1 to dia do row := dia+1-col; f := find(a, row, col, nmax, up); printf("%d, ", f); a[row, col] := f; od; else for row from 1 to dia do col := dia+1-row; f := find(a, row, col, nmax, up); printf("%d, ", f); a[row, col] := f; od; fi; up := not up : od : - R. J. Mathar (mathar(AT)strw.leidenuniv.nl), May 06 2006
|
|
CROSSREFS
|
Cf. A082187, A082188, A082189, A082190.
Sequence in context: A120750 A023826 A080688 this_sequence A076034 A034152 A114707
Adjacent sequences: A082022 A082023 A082024 this_sequence A082026 A082027 A082028
|
|
KEYWORD
|
easy,nonn,tabl
|
|
AUTHOR
|
Amarnath Murthy (amarnath_murthy(AT)yahoo.com), Apr 07 2003
|
|
EXTENSIONS
|
Edited by David Wasserman (wasserma(AT)spawar.navy.mil), Aug 09 2004
|
|
|
Search completed in 0.002 seconds
|