SHARE
TWEET

Neumann's_Random_Generator.coffee

31ph4n70m Dec 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # coffeescript solution to codeabbey challenge 24
  2. inp2 = [3488, 373, 5368, 751, 8342, 3416, 843, 6173, 7019, 381, 1054, 6303]
  3. counter = 0
  4. rsp = []
  5. vals = []
  6. aux = 0
  7. aux2 = 0
  8. for i, j in inp2
  9.     aux = i
  10.     while true
  11.         aux2 = Math.trunc((aux * aux / 100) % 10000)
  12.         if aux in vals
  13.             rsp.push counter
  14.             break
  15.         vals.push aux
  16.         counter += 1
  17.         aux = aux2
  18.     counter = 0
  19.     vals = []
  20. console.log(rsp.join(" "))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top