Modified collatz.js and triangle.js