Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dart solution to codeabbey challenge 24
- void main() {
- var inp2 = [3488, 373, 5368, 751, 8342, 3416, 843, 6173, 7019, 381, 1054, 6303];
- var counter = 0;
- var rsp = [];
- var vals = [];
- int aux = 0;
- int aux2 = 0;
- for (var i = 0; i < inp2.length; i++) {
- aux = inp2[i];
- while (true) {
- aux2 = ((aux * aux / 100) % 10000).toInt();
- if (vals.contains(aux)) {
- rsp.add(counter);
- break;
- }
- vals.add(aux);
- counter += 1;
- aux = aux2;
- }
- counter = 0;
- vals = [];
- }
- print(rsp.join(" "));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement