fork download
  1. from collections import Counter
  2.  
  3. m, n = 1, 2
  4.  
  5. c = 1
  6.  
  7. while True:
  8. d1 = Counter(str(c*m))
  9. d1.pop('0', None)
  10. d2 = Counter(str(c*n))
  11. d2.pop('0', None)
  12.  
  13. if d1 == d2:
  14. print c
  15. break
  16.  
  17. c += 1
Success #stdin #stdout 2.43s 7856KB
stdin
Standard input is empty
stdout
125874