#! /bin/sh # plot y**a mod N, should be periodic export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" N=33 y=5 title="z = $y**a mod $N" xlabel="a" ylabel="z" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" export GDFONTPATH="/usr/share/fonts/liberation" export GNUPLOT_DEFAULT_GDFONT="LiberationSans-Regular" awk 'BEGIN { N = '$N'; y = '$y'; z = 1; for( a = 0; a < N; ++a) { print a, z; z = y*z % N; } }' | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > period.gif