From cd096b85516206a883b68c7c7161c81c009a72d1 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Mon, 3 Jun 2024 03:52:22 -0500 Subject: [PATCH] Determine if a number is perfect digit to digit --- python/pdtd.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 python/pdtd.py diff --git a/python/pdtd.py b/python/pdtd.py new file mode 100644 index 0000000..9de6964 --- /dev/null +++ b/python/pdtd.py @@ -0,0 +1,11 @@ +for num in range(1, 5001): + total = 0 + rem = num + + while rem > 0: + digit = rem % 10 + total += pow(digit, digit) + rem //= 10 + + if total == num: + print(total)