Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coffeescript solution to codeabbey challenge 24
- inp2 = [3488, 373, 5368, 751, 8342, 3416, 843, 6173, 7019, 381, 1054, 6303]
- counter = 0
- rsp = []
- vals = []
- aux = 0
- aux2 = 0
- for i, j in inp2
- aux = i
- while true
- aux2 = Math.trunc((aux * aux / 100) % 10000)
- if aux in vals
- rsp.push counter
- break
- vals.push aux
- counter += 1
- aux = aux2
- counter = 0
- vals = []
- console.log(rsp.join(" "))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement