The Collatz Conjecture is an interesting sequence.
Counting the number of files and directories recursively in your current working directory, can you print out the Collatz sequence for that number?
$A = (Get-ChildItem -Recurse).count
Example if $A is 56.
Expected output would be:
28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
You can include the original number as the first of the sequence, or not – it’s up to you.
- Only output like the example (you don’t have to include the original number if you don’t want to), no other information, no errors.
- Do not include enumerating $A in your script unless you add to it (score will only include additions to the enumeration).
- If you don’t have enough files or directories to do this…change directory to somewhere you do 😉
- Do not put anything you see or do here into a production script.
- Please explode your code so others can read along.
- If the script can’t be run again without clearing values please state so.
- Enjoy yourselves.
Current Leadership board: