Powerful Digit Sum¶
Python's unlimited precision ints save the day again!
In [1]:
def digit_sum(n):
total = 0
while n != 0:
total += n % 10
n //= 10
return total
In [2]:
max(digit_sum(a^b) for a in range(1, 100) for b in range(1, 100))
Out[2]:
972
Copyright (C) 2025 filifa¶
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.