an2022bis.py

Created by schraf

Created on January 10, 2022

343 Bytes

Ma playlist consacrée à la NUMWORKS


def miroir(n):
  s = list(str(n))
  s.reverse()
  return int(''.join(s))

# intervalle d'etude
annees = range(2000,3000)

for n1 in annees:
  n2 = miroir(n1)
  if n2 in annees and n2 >= n1 and n1 ** 2 == miroir(n2 ** 2):
    print("{}^2 = {}".format(n1, n1 ** 2))
    print("{}^2 = {}".format(n2, n2 ** 2))
    print("-" * 16)