Bitcoin Forum
November 20, 2017, 10:15:45 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Calculate total coins at height  (Read 972 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
Join ICO Now Coinlancer is Disrupting the Freelance marketplace!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511172945
Hero Member
*
Offline Offline

Posts: 1511172945

View Profile Personal Message (Offline)

Ignore
1511172945
Reply with quote  #2

1511172945
Report to moderator
1511172945
Hero Member
*
Offline Offline

Posts: 1511172945

View Profile Personal Message (Offline)

Ignore
1511172945
Reply with quote  #2

1511172945
Report to moderator
1511172945
Hero Member
*
Offline Offline

Posts: 1511172945

View Profile Personal Message (Offline)

Ignore
1511172945
Reply with quote  #2

1511172945
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!