Skip to content

Instantly share code, notes, and snippets.

@mentix02
Created May 16, 2018 14:28
Show Gist options
  • Save mentix02/73f8546f1686470378b8558aa8f26dfc to your computer and use it in GitHub Desktop.
Save mentix02/73f8546f1686470378b8558aa8f26dfc 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(len(res))
print(len(res))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment