Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Prime-decomposition/Slate/prime-decomposition.slate
Normal file
15
Task/Prime-decomposition/Slate/prime-decomposition.slate
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
n@(Integer traits) primesDo: block
|
||||
"Decomposes the Integer into primes, applying the block to each (in increasing
|
||||
order)."
|
||||
[| div next remaining |
|
||||
div: 2.
|
||||
next: 3.
|
||||
remaining: n.
|
||||
[[(remaining \\ div) isZero]
|
||||
whileTrue:
|
||||
[block applyTo: {div}.
|
||||
remaining: remaining // div].
|
||||
remaining = 1] whileFalse:
|
||||
[div: next.
|
||||
next: next + 2] "Just look at the next odd integer."
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue