-
-
Save ynaoto/d6f6115a9913d74a0320105be140cc67 to your computer and use it in GitHub Desktop.
This file contains 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
# https://twitter.com/nanaio627/status/813413642439835649 | |
import sys | |
def diff(a): | |
b = [] | |
for i in range(len(a)-1): | |
b.append(a[i+1]-a[i]) | |
return b | |
N=int(sys.argv[1]) | |
a=[i**N for i in range(1,N+4)] | |
#print a | |
for i in range(N): | |
a = diff(a) | |
#print a | |
b=filter(lambda x: x!=a[0], a[1:]) | |
print N, len(b)==0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment