Hi all

Im all new to this forum. I have a website project where I have run into a math problem.

My problem is that i get a specifik number (n), which creates a number of boxes in a matrix. The coordinates of each box should be calculated using a formula, but I cant solve it myself.

The following should be true:

n=1, x=1, y=1

n=2, x=2, y=1

n=3, x=3, y=1

n=4, x=4, y=1

n=5, x=1, y=2

n=6, x=2, y=2

n=7, x=3, y=2

n=8, x=4, y=2

n=9, x=1, y=3

And so forth

I need a function which says something:

If n=something, x=something and y=something.

The matrix is a 4xZ matrix, where Z depends on the number of entries.

With 1-4 entries, Z=1, with 5-8 entries, Z=2 etc.

I can solve it for n=1-4, but then it gets too complicated for me.

I hope anyone can help or point me in the right direction.

Thanks a lot :-)