Bitcoin Forum
November 10, 2024, 04:24:18 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Calculate total coins at height  (Read 1120 times)
tcatm (OP)
Sr. Member
****
Offline Offline

Activity: 337
Merit: 285


View Profile
April 05, 2011, 07:41:50 PM
Last edit: April 05, 2011, 11:30:25 PM by tcatm
 #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
FatherMcGruder
Sr. Member
****
Offline Offline

Activity: 322
Merit: 250



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


View Profile
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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!