Skip to content

Instantly share code, notes, and snippets.

@mentix02
Last active May 16, 2018 14:30
Show Gist options
  • Save mentix02/4a339c53cfa60f29491f8b822371deb5 to your computer and use it in GitHub Desktop.
Save mentix02/4a339c53cfa60f29491f8b822371deb5 to your computer and use it in GitHub Desktop.
a Quora question for checking how many numbers 6 digit numbers are divisible by 495
"""
question on quora
https://www.quora.com/How-many-6-digit-palindromes-are-divisible-by-495
"""
nums = [str(x) for x in range(100000, 1000000)]
def check_palindrome(num):
if num == num[::-1]:
return True
else:
return False
pal_nums = []
for num in nums:
if check_palindrome(num):
pal_nums.append(num)
res = []
for pal_num in pal_nums:
if int(pal_num) % 495 == 0:
res.append(pal_num)
print(res)
print(len(res))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment