Skip to content

Instantly share code, notes, and snippets.

@ynaoto
Created December 27, 2016 05:26
Show Gist options
  • Save ynaoto/d6f6115a9913d74a0320105be140cc67 to your computer and use it in GitHub Desktop.
Save ynaoto/d6f6115a9913d74a0320105be140cc67 to your computer and use it in GitHub Desktop.
# 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