summaryrefslogtreecommitdiff
path: root/miralib/ex/powers.m
blob: 019a1395b5cf6ec6a66e6b53a66cfcef5cd453f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
||prints a table of powers 2 to 5 of the numbers 1 to 20
||to see the table, say
||	output

output = title ++ captions ++ concat (map line [1..20])

title = cjustify 60 "A TABLE OF POWERS" ++ "\n\n"

captions = format "N" ++ concat (map caption [2..5]) ++ "\n"

caption i = format ("N^" ++ shownum i)

format = rjustify 12

line n = concat [format (show(n^i)) | i<-[1..5]] ++ "\n"