1) Double Number
no = int(input('Enter a Number: '))
if no > 9 and no < 100:
print ( f'{no} is double Number')
OUTPUT:
Enter a Number: 54
54 is double Number
2) Neon Number
A neon number is a number where the sum of the digits of its square is equal to the number itself.
For example, 9 is a neon number because 9² = 81 and the sum of its digits is 8 + 1 = 9.
def sum (n):
total = 0
while n > 0:
total = total + n%10
n//=10
return total
no = int(input('Enter a Number: '))
square = no**2
result = sum(square)
if no == result :
print ('Neon Number')
else:
print ('Not a Neon Number')
OUTPUT:
Enter a Number: 9
Neon Number
3)Strong Number
A strong number is a positive number where the sum of the factorials of its digits equals the number itself. For example, 145 is a strong number because 1! + 4! + 5! = 1 + 24 + 120 = 145.
def fact(n):
if n == 1:
return 1
else:
return n*fact(n-1)
def sum (n):
total = 0
while n >0:
total = total + fact(n%10)
n//=10
return total
no = int(input('Enter a Number: '))
result = sum(no)
if no == result :
print ('Strong Number')
else:
print('Not a Strong Number')
OUTPUT:
Enter a Number: 145
Strong Number
4) Automorphic Number
An automorphic number is an integer whose square ends with the exact same digits as the number itself.
For example, 5² = 25 ends in 5, and 76² = 5776 ends in 76.
def count_of_digits (n):
count = 1
while n > 0:
count *= 10
n//=10
return count
no = int(input('Enter a Number: '))
square = no ** 2
count = count_of_digits(no)
if (no == square%count):
print('Automorphic number')
else:
print('Not an Automorphic number')
OUTPUT:
Enter a Number: 25
Automorphic number
5) Duck Number
A duck number is a positive number that contains at least one zero digit, provided the zero does not appear at the very beginning of the number.
no = input('Enter a Number: ')
if no[0] == '0' or '0' not in no:
print('Not a Duck number')
else:
if '0' in no :
print('Duck Number')
OUTPUT:
Enter a Number: 125063
Duck Number
6) Spy Number
A spy number is a positive integer where the sum of its digits equals the product of its digits. For example, 1124 is a spy number because (1 + 1 + 2 + 4 = 8) and (1 \times 1 \times 2 \times 4 = 8).
def sum (n):
total = 0
multiply = 1
while n >0:
total = total + n%10
multiply *= n%10
n//=10
return total == multiply
no = int(input('Enter a Number: '))
result = sum(no)
if result:
print('Spy Number')
else:
print('Not a Spy Number')
OUTPUT:
Enter a Number: 1124
Spy Number
Top comments (0)