I’m struggling with the problem below, which I’ve put in a script
so it can be easily copied to play with.
(* Suppose I have a square array of items like
the one below:
a b c
d e f
g h i
and I know the position in a list of one of those items,
e.g., item 6 of the list {a, b, c, d, e, f, g, h, i} (item f)
how can I then identify the row and column in the
square array in which that item is found; in this
case, row 2, column 3?*)
(* I'd like to use arithmetic to do that rather
than some type of loop or search routine and
my attempts to date with mod, div, etc. always
present at least one anomaly and the real
case I'm struggling with is much larger
that 3 x 3, so I'm looking for something
general based on the square root of the
array size. *)