aboutsummaryrefslogtreecommitdiff
path: root/challenge-023
diff options
context:
space:
mode:
authorRoger Bell_West <roger@firedrake.org>2019-08-30 17:11:42 +0100
committerRoger Bell_West <roger@firedrake.org>2019-08-30 17:11:42 +0100
commit58fb751e6c0ae0b90f487db979916007a07c0192 (patch)
treed7783727bca3afe9ed34c91004112439060ef7ce /challenge-023
parent2505b4187fa8d57aa9c3c440bd3d31ca28840076 (diff)
downloadperlweeklychallenge-club-58fb751e6c0ae0b90f487db979916007a07c0192.tar.gz
perlweeklychallenge-club-58fb751e6c0ae0b90f487db979916007a07c0192.tar.bz2
perlweeklychallenge-club-58fb751e6c0ae0b90f487db979916007a07c0192.zip
An entry in PostScript. NeilB made me do it.
Diffstat (limited to 'challenge-023')
-rw-r--r--challenge-023/roger-bell-west/postscript/ch-2.ps31
-rwxr-xr-xchallenge-023/roger-bell-west/postscript/ch2-ps-runme2
2 files changed, 33 insertions, 0 deletions
diff --git a/challenge-023/roger-bell-west/postscript/ch-2.ps b/challenge-023/roger-bell-west/postscript/ch-2.ps
new file mode 100644
index 0000000000..6b4eb5f6f1
--- /dev/null
+++ b/challenge-023/roger-bell-west/postscript/ch-2.ps
@@ -0,0 +1,31 @@
+%! not DSC compliant, no rasterisation, run me where you can see %stdout
+
+/ns 30 string def
+/n input cvi def
+
+/f 2 def
+
+{
+ n f mod 0 eq {
+ /n n f idiv def
+ (%stdout) (w) file
+ dup f ns cvs writestring
+ (\n) writestring
+ }
+ {
+ f 2 eq {
+ /f f 1 add def
+ }
+ {
+ /f f 2 add def
+ } ifelse
+ f f mul n gt {
+ exit
+ } if
+ } ifelse
+} loop
+
+(%stdout) (w) file
+dup n ns cvs writestring
+(\n) writestring
+(%stdout) (w) file flushfile
diff --git a/challenge-023/roger-bell-west/postscript/ch2-ps-runme b/challenge-023/roger-bell-west/postscript/ch2-ps-runme
new file mode 100755
index 0000000000..962de58b1a
--- /dev/null
+++ b/challenge-023/roger-bell-west/postscript/ch2-ps-runme
@@ -0,0 +1,2 @@
+#! /bin/sh
+gs -sinput=8347632417364218394 -- ch-2.ps