Skip to content

Instantly share code, notes, and snippets.

@mtovmassian
Created February 10, 2021 20:46
Show Gist options
  • Save mtovmassian/eae3f5eeb0da56644ed995f15cb818cc to your computer and use it in GitHub Desktop.
Save mtovmassian/eae3f5eeb0da56644ed995f15cb818cc to your computer and use it in GitHub Desktop.
Demlo palindromic triangle
def calc_base_one_repunits(n):
# https://en.wikipedia.org/wiki/Repunit
return sum(
map(lambda x: pow(10, x), range(0, n))
)
for i in range(1, int(input("Triangle size: "))+1):
print(pow(calc_base_one_repunits(i), 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment