finding primes with dcpu-16

Apr 13th, 2012
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   set a,0 ;atmtocheck
  2.   set b, 0  ;current modulo
  3.   set c,100  ; border to check
  4.   set i,1 ;index of tochecking prim
  5.   set j,0 ;number of found prims
  6.   :outerloop add i,1
  7.   set a,i
  8.   :innerloop sub a,1     ;donewithchecking
  9.   ife a,1
  10.   set pc ,donewithchecking
  11.   set b,i
  12.   mod b,a
  13.   ife b,0   ;!isprim()
  14.   set pc, aftersaving
  15.   ifn b,0
  16.   set pc,innerloop
  17.   :donewithchecking set push,i;set [j],i
  18.   add j,1
  19.   :aftersaving
  20.   ;set x, 0xffff
  21.   ;sub x,sp
  22.   ifn j,c
  23.   set pc,outerloop
  24.   :crash set pc, crash
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.