Skip to content

Instantly share code, notes, and snippets.

@20chan
Created May 2, 2018 05:56
Show Gist options
  • Save 20chan/2dc30936f71231a029f07eb3a981c052 to your computer and use it in GitHub Desktop.
Save 20chan/2dc30936f71231a029f07eb3a981c052 to your computer and use it in GitHub Desktop.
Prime number algorithm written in marbelous
}0
Pr
Re
:Re
}0
=1
ip np
:ip
}0
\/ 49 74 27 73 20 61 20 70 72 69 6D 65 2E
:np
}0
\/ 49 74 27 73 20 6E 6F 74 20 61 20 70 72 69 6D 65 2E
# input is prime
:Pr
}0 02
pr it
{0 ..
:prit
}0 }1 }0 }1 }0 }1 01 00
nu eq &0 &0 .. +1 &2 &3
=1 &0 md lr &1 &1 {0 {0
&2 \/ =0 &1 pr it
\/ .. &3 \/ {0
.. .. \/
# modular
:mdlr
}0 }1 00
mo du it
{0 .. ..
:moduit
.. }1 }2
}0 Mu lt .. }2 ..
Le ss .. }0 -1 }1
=0 &0 .. &0 &0 &0
&1 .. .. .. Mu lt
\/ .. }2 Su bt ..
}0 }1 +1 {0 .. ..
&1 &1 &1 .. .. ..
mo du it .. .. ..
{0 .. .. .. .. ..
:nueq
}0 }1 }0 }1 01 00 00
Le ss Gr tr &0 &1 &2
=0 &1 =0 &2 {0 {0 {0
&0 .. &0 .. .. .. ..
\/ \/ \/ \/
#include dec_out.mbl
#include logical_operation.mbl
#include arithmetic.mbl
#include bitwise_operations.mbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment