aboutsummaryrefslogtreecommitdiff
path: root/challenge-023/roger-bell-west/postscript/ch-2.ps
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-023/roger-bell-west/postscript/ch-2.ps')
-rw-r--r--challenge-023/roger-bell-west/postscript/ch-2.ps31
1 files changed, 31 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