Here is a script in MATLAB/Octave that takes 7 as input and prints the pattern you described, with each number on a separate line:
main.m230 chars11 lines
Running this script will give the desired output:
main.m75 chars26 lines
Note: The pattern is stored in a row vector pattern
, and we use disp(pattern')
to display it with each number on a new line.
gistlibby LogSnag