#!/usr/local/bin/gawk -f # # primecube.awk # by F. Poyo # v.1.0 -- Sep. 25, 1996 # # This awk-script outputs a prime order magic cube. Run this by # # gawk -f primecube.awk # # Then, type the order. For example, if you type 7, the script # outputs 7x7x7 magic cube. The number must be prime number. # The number must be larger than 6. # BEGIN{no_solution=0;printf("The order must be a prime number (>6).\n"); printf("Input the order N:");} {N=$0; checkN(); makecube(); exit(0); } /end/{exit(0);} END{ if(no_solution!=1) { check_cube(); printcube(); } } # function cleancube(i,j,k) { for(i=0;i