Skip to content

Instantly share code, notes, and snippets.

@walkingmask
Created October 11, 2016 03:33
Show Gist options
  • Save walkingmask/df00d0f730032d7c9c42f64dcb88bd2d to your computer and use it in GitHub Desktop.
Save walkingmask/df00d0f730032d7c9c42f64dcb88bd2d to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# fishnumv1.py
# 2016/10/11(火)
# walkingmask
# http://b.hatena.ne.jp/entry/www.slideshare.net/DoomKobayashi/ver1-png
def machineA(x):
return x+1
def machineB(x,y):
if x == 0:
return machineA(y)
elif y == 0:
return machineB(x-1,y+1)
else:
return machineB(x-1,machineB(x,y-1))
def machineC(x,y):
if x == 0:
return machineB(y,y)
elif y == 0:
return machineC(x-1,y+1)
else:
return machineC(x-1,machineC(x,y-1))
#print(machineC(3,3))
print(machineC(1,1))
@walkingmask
Copy link
Author

machineC(3,3)は再帰深さ制限に引っかかって実行できず.さすが巨大数...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment