fork download
  1. count = 0
  2.  
  3. for i in range(1, 2396745 + 1):
  4. value = i
  5.  
  6. if value % 8 != (value // 8) % 8:
  7. continue
  8.  
  9. digits_sum = 0
  10. digits_prod = 1
  11.  
  12. while value > 0:
  13. digit = value % 8
  14. digits_sum += digit
  15. digits_prod *= digit
  16. value = value // 8
  17.  
  18. if digits_sum == 8 and digits_prod != 0:
  19. count += 1
  20.  
  21.  
  22. print(count)
Success #stdin #stdout 1.06s 9052KB
stdin
Standard input is empty
stdout
43