Guest User

Untitled

a guest
Dec 14th, 2019
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from collections import Counter
  2. def primfacs(n):
  3. if n % 2 == 0:
  4. primfac = [0,0]
  5. else:
  6. primfac = [0,0]
  7. while n % 2 == 0:
  8. n = n / 2
  9. primfac[0] += 1
  10. primfac[1] = n
  11. return primfac
  12.  
  13.  
  14.  
  15. t = int(input())
  16. for i in range(t):
  17. n = int(input())
  18. A = list(map(int, input().split()))
  19. Ost = []
  20. for j in range(n):
  21. Ost.append(primfacs(A[j]))
  22. Ost.sort()
  23. d = {}
  24. for j in range(len(Ost)):
  25. d[Ost[j][1]] = Ost[j][0]
  26. print(sum(list(d.values())))
RAW Paste Data