Bitcoin Forum
April 25, 2017, 04:59:29 AM
 News: Latest stable version of Bitcoin Core: 0.14.1  [Torrent]. (New!)
 Home Help Search Donate Login Register
 Pages: [1]
 Author Topic: Calculate total coins at height  (Read 918 times)
tcatm
Sr. Member

Offline

Activity: 337

 April 05, 2011, 07:41:50 PM

Hey,

here's some code that calculates the total number of bitcoins generated at a certain height:

Code:
def t(h):
return (sum([21e4*int(50e8/2**k) for k in xrange(int((h+1)/21e4))])+int(50e8/2**(int((h+1)/21e4)))*((h+1)-(int((h+1)/21e4))*21e4))/1e8
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1493096369
Hero Member

Offline

Posts: 1493096369

Ignore
 1493096369

1493096369
 Report to moderator
FatherMcGruder
Sr. Member

Offline

Activity: 322

 April 05, 2011, 07:47:20 PM

Use my Trade Hill referral code: TH-R11519

Check out bitcoinity.org and Ripple.

Shameless display of my bitcoin address:
1Hio4bqPUZnhr2SWi4WgsnVU1ph3EkusvH
ryepdx
Hero Member

Offline

Activity: 714

 April 05, 2011, 08:41:12 PM

Hey,

here's some code that calculates the total number of bitcoins generated at a certain height:

Code:
def t(h):
return sum([21e4*int(50e8/2**k) for k in xrange(int((h+1)/21e4))])+int(50e8/2**(int((h+1)/21e4)))*((h+1)-(int((h+1)/21e4))*21e4)/1e8

Very clever...
 Pages: [1]
 « previous topic next topic »