Skip to content

Instantly share code, notes, and snippets.

@abromberg
Last active December 16, 2015 18:48
Show Gist options
  • Save abromberg/5479950 to your computer and use it in GitHub Desktop.
Save abromberg/5479950 to your computer and use it in GitHub Desktop.
Function to determine theoretical number of Bitcoin in existence as a function of the number of days since January 3, 2009, when Bitcoin mining began.
from math import floor
def B(t):
max = 21*(10**6) # hard cap on number of BTC
C = 7200 # initial number of BTC produced per day
T = 4*365 # number of days in 4 years
B = sum(C / 2**int(floor(i/T)) for i in range(0, t))
return min(B, max)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment