Bitcoin Forum
May 12, 2024, 12:43:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Calculate total coins at height  (Read 1102 times)
tcatm (OP)
Sr. Member
****
Offline Offline

Activity: 337
Merit: 265


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
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715517834
Hero Member
*
Offline Offline

Posts: 1715517834

View Profile Personal Message (Offline)

Ignore
1715517834
Reply with quote  #2

1715517834
Report to moderator
1715517834
Hero Member
*
Offline Offline

Posts: 1715517834

View Profile Personal Message (Offline)

Ignore
1715517834
Reply with quote  #2

1715517834
Report to moderator
1715517834
Hero Member
*
Offline Offline

Posts: 1715517834

View Profile Personal Message (Offline)

Ignore
1715517834
Reply with quote  #2

1715517834
Report to moderator
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!