%!PS /aeq { 2 dict begin /a exch def /b exch def a length b length eq { /e true def 0 1 a length 1 sub { dup a exch get exch b exch get ne { /e false def exit } if } for e } { false } ifelse end } bind def /bubblesort { mark exch aload pop counttomark /idx exch store { 0 1 idx 1 sub { pop 2 copy gt { exch } if idx 1 roll } for idx 1 roll /idx idx 1 sub store idx 0 eq { exit } if } loop ] } store /apush { % [a b] c -> [a b c] /t exch def [ exch aload pop t ] } bind def /i2s { dup log cvi 1 add string cvs } bind def /genprimes { /mx exch def /primesh mx dict def 2 1 3 { primesh exch true put } for 6 6 mx 1 add { dup 1 sub exch 1 add 2 exch { dup mx le { primesh exch true put } { pop } ifelse } for } for /q [ 3 5 7 ] def /qi 0 def /p 2 def /mr mx sqrt cvi def { p mr le not { exit } if primesh p known { p dup mul p mx { primesh exch undef } for } if q length qi sub 2 le { /q q q q length 1 sub get 4 add apush def /q q q q length 1 sub get 2 add apush def } if /p q qi get def /qi qi 1 add def } loop /primes 0 array def primesh { pop /primes exch primes exch apush def } forall primes bubblesort } bind def /ltruncprimes { /co exch def /out 0 array def /i 0 def 500 genprimes dup length dup /p exch array def /pp exch dict def { i2s dup p exch i exch put pp exch true put /i i 1 add def } forall p { dup length /l exch def /pc exch def /c true def 1 1 l 1 sub { pc exch dup l exch sub getinterval pp exch known not { /c false def exit } if } for c { /out out pc cvi apush def /co co 1 sub def co 0 le { exit } if } if } forall out } bind def 20 ltruncprimes [ 2 3 5 7 13 17 23 37 43 47 53 67 73 83 97 113 137 167 173 197 ] aeq { (Pass) } { (FAIL) } ifelse =