Bitcoin Forum
December 11, 2016, 10:17:50 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Calculate total coins at height  (Read 888 times)
tcatm
Sr. Member
****
Offline Offline

Activity: 337


View Profile
April 05, 2011, 07:41:50 PM
 #1

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.
1481451470
Hero Member
*
Offline Offline

Posts: 1481451470

View Profile Personal Message (Offline)

Ignore
1481451470
Reply with quote  #2

1481451470
Report to moderator
1481451470
Hero Member
*
Offline Offline

Posts: 1481451470

View Profile Personal Message (Offline)

Ignore
1481451470
Reply with quote  #2

1481451470
Report to moderator
FatherMcGruder
Sr. Member
****
Offline Offline

Activity: 322



View Profile WWW
April 05, 2011, 07:47:20 PM
 #2


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 Offline

Activity: 714



View Profile WWW
April 05, 2011, 08:41:12 PM
 #3

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...  Lips sealed
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!