Four is the number of letters in the ...: Difference between revisions
Content added Content deleted
Line 200: | Line 200: | ||
Base.eltype(iter::CountLetters) = Int |
Base.eltype(iter::CountLetters) = Int |
||
function firstN(n = 201) |
|||
countlet = CountLetters() |
|||
print("It is interesting how identical lengths align with 20 columns.\n 1: 4") |
|||
iter_result = iterate(countlet) |
|||
itercount = 2 |
|||
while iter_result != nothing |
|||
(wlen, state) = iter_result |
|||
print(lpad(string(wlen), 4)) |
|||
if itercount % 20 == 0 |
|||
print("\n$(itercount+1):") |
|||
elseif itercount == n |
|||
break |
|||
end |
|||
iter_result = iterate(countlet, state) |
|||
itercount += 1 |
|||
end |
|||
println() |
|||
end |
|||
function sumwords(iterations) |
function sumwords(iterations) |
||
Line 221: | Line 240: | ||
"last word \"$lastword\" with $(length(lastword)) letters.") |
"last word \"$lastword\" with $(length(lastword)) letters.") |
||
end</lang> {{output}} <pre> |
end</lang> {{output}} <pre> |
||
It is interesting how identical lengths align with 20 columns. |
|||
1: 4 2 3 6 2 7 2 3 5 4 2 4 8 3 2 3 6 5 2 3 |
|||
21: 5 3 2 3 6 3 2 3 5 5 2 3 5 3 2 3 7 5 2 3 |
|||
41: 6 4 2 3 5 4 2 3 5 3 2 3 8 4 2 3 7 5 2 3 |
|||
61: 10 5 2 3 10 3 2 3 9 5 2 3 9 3 2 3 11 4 2 3 |
|||
81: 10 3 2 3 10 5 2 3 9 4 2 3 11 5 2 3 12 3 2 3 |
|||
101: 11 5 2 3 12 3 2 3 11 5 2 3 11 3 2 3 13 5 2 3 |
|||
121: 12 4 2 3 11 4 2 3 9 3 2 3 11 5 2 3 12 4 2 3 |
|||
141: 11 5 2 3 12 3 2 3 11 5 2 3 11 5 2 3 13 4 2 3 |
|||
161: 12 3 2 3 11 5 2 3 8 3 2 3 10 4 2 3 11 3 2 3 |
|||
181: 10 5 2 3 11 4 2 3 10 4 2 3 10 3 2 3 12 5 2 3 |
|||
201: 11 |
|||
2202 words -> 2202 iterations, 14035 letters total, last word "ninety-ninth" with 12 letters. |
2202 words -> 2202 iterations, 14035 letters total, last word "ninety-ninth" with 12 letters. |
||
1000 words -> 1000 iterations, 6290 letters total, last word "in" with 2 letters. |
1000 words -> 1000 iterations, 6290 letters total, last word "in" with 2 letters. |