Background
The Collatz Conjecture is quite well-known. Take any natural number. Triple and increment if odd; cut in half if even. Repeat, and it will reach 1 eventually. This famous conjecture, however, is only that, for it is yet unproven.
Little-known to the world, that was not Lothar Collatz's first attempt at fame. His first Conjecture (now proven) was a touch simpler:
- Take any natural number n.
- While n ≠ 4, find the length of its written-out form (English). Store this value to n.
The conjecture is that all natural numbers will eventually become 4. This did not catch on as well as Collatz had hoped, so he returned to the drawing board.
Your task
Read a positive integer n < 2147483648 (2^31) from input and return/print the number of iterations required to reach 4.
Things to note
Do not use and. 228 is "two hundred twenty-eight," not "two hundred and twenty-eight."
Do not use articles. 145 is "one hundred forty-five," not "a hundred forty-five.)
Commas set apart each three orders or magnitude: "one million, four hundred eighty-two thousand, one hundred seventy-five."
Punctuation is counted. Spaces are not. Hyphenate 21-99 except multiples of ten.
Test cases
4 (four): 0
3 (three→five→four): 2
6278 (six thousand, two hundred seventy-eight→thirty-five→eleven→six→three→five→four): 6
1915580 (one million, nine hundred fifteen thousand, five hundred eighty→fifty-five→ten→three→five→four): 5
2147483647 (two billion, one hundred forty-seven million, four hundred eighty-three thousand, six hundred forty-seven→ninety-three→twelve→six→three→five→four): 6
This is code-golf, so the shortest code (in bytes) in each language WINS! Good luck!
one million, nine hundred fifteen thousand, five hundred eighty
is of length63
, not55
. The correct result for1915580
is6
, not5
. \$\endgroup\$Punctuation is counted. Spaces are not
\$\endgroup\$10^66
need to be handled? \$\endgroup\$