rac_annee.py

Created by schraf

Created on July 01, 2022

176 Bytes

Suite au Tweet de nsi.xyz, voici un petit programme qui recherche les nombres n se terminant par l’année voulue et tels que rac(n + rac(n + rac( n + …))) donne un entier. Par exemple n = 1722 correspond au 1er juillet 2022 (1.7.22) et rac(1722 + rac(1722 + rac(1722 + …))) = 42 qui est un entier.

  • Lancez le programme et tapez 22 pour l’année 2022. Remarquez que certaines solutions ne sont pas de vraies dates
  • En quelle année aurons-nous à nouveau des dates donnant des entiers en appliquant la succession infinie de racines carrées ?


aa = input('Annee ? ')
n = 2
while True:
  p = n * (n - 1)
  if p > 311200 + int(aa): break  
  if str(p)[-2:] == aa:
    print(n, p)
  n += 1  
print('fin')

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.