fork download
  1. while x = gets
  2. t = []
  3. x = x.to_i
  4. p = Math.sqrt(x)
  5. p = p.to_i
  6. w = x % p
  7. if w == 0
  8. n = 1
  9. else
  10. n = 0
  11. end
  12. i = 1
  13. while i<= p
  14. if x % i == 0
  15. t = t.push(i)
  16. puts i
  17. end
  18. i = i + 1
  19. end
  20. d = t.length
  21. print "huj", t.length, "\n"
  22. print t, "\n"
  23. i1 = d - 1 - n
  24. puts i1
  25. while i1 == 0
  26. g = x/t[i1]
  27. puts g
  28. i1 = i1 - 1
  29. end
  30. end
Success #stdin #stdout 0s 4760KB
stdin
255
stdout
1
3
5
15
huj4
[1, 3, 5, 15]
2