Last active
August 29, 2015 14:14
-
-
Save fabian57/655fea9249f9036d7c5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from official.ref.is_palindromic_1 import is_palindromic | |
result = 0 | |
for i in range(1, 1000000): | |
if is_palindromic(str(i)) and is_palindromic(bin(i)[2:]): | |
result += i | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dans
is_palindromic(str(bin(i))[2:])
, tu peux enleverstr
, le résultat debin
est déjà une chaîne. Aucun problème sinon. Je me demande si utiliser[::-1]
pour tester la palindromie, plus tôt que d'appeler notre fonction, serait plus rapide ou pas (sachant qu'on ne ferait pas de sortie prématurée dans ce cas)...