A Narcissistic number is a positive integer that equals the sum of M-th powers of their digits when the number is M-digit long.
153 is a Narcissistic number, since: 13+53+33=153.
Sloane's A005188 has an article on this, in which inter-alia it is mentioned that the sequence of Narcissistic numbers terminates at the 88th term.
A Cerossistic number is a base ten M-digit long positive integer which is equal to the sum of M-th powers of one less than each of the digits.
For example, if we check for 371 we find that:
23+63+03 = 224, which is NOT equal to 371.
Determine the smallest Cerossistic number.
Note: No Cerossistic number can admit of the digit zero.
I tested up to 100,000,000 and found the following:
[26, 126, 217, 729, 4193, 24228197]
I cannot rule out the existence of larger solutions.
This sequence is not in Sloane's oeis.
But in answer to the question: 26 is the smallest Cerossistic number.
--------------------
def cero(n):
""" input integer; check for 0s; compute Cerossistic value """
a = str(n)
length = len(a)
if '0' in a:
return False
iList = []
for c in a:
iList.append((int(c)-1)**length)
if sum(iList) == n:
return True
return False
big = 100000000
cerossistic_numbers = []
for i in range(big):
if cero(i):
print(i)
cerossistic_numbers.append(i)
print(cerossistic_numbers)
Edited on January 5, 2023, 9:19 am
|
Posted by Larry
on 2023-01-05 09:18:27 |