added dynamic cache to collatz.py
added cache, removed optimization.