Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Prime-decomposition/Smalltalk/prime-decomposition.st
Normal file
14
Task/Prime-decomposition/Smalltalk/prime-decomposition.st
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Integer extend [
|
||||
primesDo: aBlock [
|
||||
| div next rest |
|
||||
div := 2. next := 3.
|
||||
rest := self.
|
||||
[ [ rest \\ div == 0 ]
|
||||
whileTrue: [
|
||||
aBlock value: div.
|
||||
rest := rest // div ].
|
||||
rest = 1] whileFalse: [
|
||||
div := next. next := next + 2 ]
|
||||
]
|
||||
]
|
||||
123456 primesDo: [ :each | each printNl ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue