Advertisement
31ph4n70m

Neumann's_Random_Generator.dart

Dec 19th, 2019
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.54 KB | None | 0 0
  1. // dart solution to codeabbey challenge 24
  2. void main() {
  3.     var inp2 = [3488, 373, 5368, 751, 8342, 3416, 843, 6173, 7019, 381, 1054, 6303];
  4.     var counter = 0;
  5.     var rsp = [];
  6.     var vals = [];
  7.     int aux = 0;
  8.     int aux2 = 0;
  9.     for (var i = 0; i < inp2.length; i++) {
  10.         aux = inp2[i];
  11.         while (true) {
  12.             aux2 = ((aux * aux / 100) % 10000).toInt();
  13.             if (vals.contains(aux)) {
  14.                 rsp.add(counter);
  15.                 break;
  16.             }
  17.             vals.add(aux);
  18.             counter += 1;
  19.             aux = aux2;
  20.         }
  21.         counter = 0;
  22.         vals = [];
  23.     }
  24.     print(rsp.join(" "));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement