RecursiveSeriesStream.st
changeset 5262 03f0b6c2ca34
parent 5261 ccb88f201f54
equal deleted inserted replaced
5261:ccb88f201f54 5262:03f0b6c2ca34
    63         |max bits collatz newNums|
    63         |max bits collatz newNums|
    64 
    64 
    65         newNums := OrderedCollection new.        
    65         newNums := OrderedCollection new.        
    66         bits := SortedCollection new.
    66         bits := SortedCollection new.
    67         max := 2.
    67         max := 2.
    68         collatz := RecursiveSeriesStream on:[:n | n even ifTrue:[n/2] ifFalse:[n*3+1]] startValue:1.
    68         collatz := RecursiveSeriesStream on:[:n | n even ifTrue:[n/2] ifFalse:[(n*3+1)/2]] startValue:1.
    69         1 to:100000 do:[:n0 |
    69         1 to:100000 do:[:n0 |
    70             newNums removeAll.    
    70             newNums removeAll.    
    71             collatz startValue:n0.
    71             collatz startValue:n0.
    72             [
    72             [
    73                 |n|
    73                 |n|