// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class MainClass { private const int COLS = 5; private const int ROWS = 3; private static void Test(int n) { for(int i = 0; i < n;i ++) { int g1 = i / COLS + 1; double f = ROWS/(double)n; int g2 = (int)(i * f + 1); int g3; int cut = COLS * ((n - 1) % ROWS + 1); if(i <= cut) { g3 = i / COLS + 1; } else { g3 = cut / COLS + (i - cut) / (COLS - 1) + 1; } Console.WriteLine(i + " " + g1 + " " + g2 + " " + g3); } } public static void Main(string[] args) { Test(13); Test(14); Test(15); } } }