Bitcoin Forum
June 22, 2018, 04:27:50 AM
 Welcome, Guest. Please login or register.
 News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 Home Help Search Donate Login Register
 Pages: [1]
 Author Topic: Calculate total coins at height  (Read 976 times)
tcatm
Sr. Member

Offline

Activity: 337
Merit: 250

 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
1529641670
Hero Member

Offline

Posts: 1529641670

Ignore
 1529641670

1529641670
 Report to moderator
1529641670
Hero Member

Offline

Posts: 1529641670

Ignore
 1529641670

1529641670
 Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1529641670
Hero Member

Offline

Posts: 1529641670

Ignore
 1529641670

1529641670
 Report to moderator
1529641670
Hero Member

Offline

Posts: 1529641670

Ignore
 1529641670

1529641670
 Report to moderator
FatherMcGruder
Sr. Member

Offline

Activity: 322
Merit: 250

 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
Merit: 500

 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 »
Jump to:

Sponsored by , a Bitcoin-accepting VPN.