Post Reply 
Programming Exercise (HP-15C, 15C LE - and others)
03-26-2014, 12:00 AM
Post: #35
RE: Programming Exercise (HP-15C, 15C LE - and others)
(03-25-2014 11:46 PM)churichuro Wrote:  on my HP50 with UBasic this take 5.5 Sec

Code:

suma=0
for n= 10000 to 1 step -1
  suma= suma + (1 / n)* (-1)^ (n+1)
next
fix 10.9
print
print "Sum ="; suma
end

result:

UBasic v 0.2b (C)
Suma =0.693097183
ready!

press << ON >>

Would you try Thomas Klemm's idea, that is, evaluating two terms per loop? Thanks!

Code:

suma=0
for n= 5000 to 1 step -1
  suma= suma + 1 / (n - 1) - 1 / n
next
fix 10.9
print
print "Sum ="; suma
end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming Exercise (HP-15C, 15C LE - and others) - Gerson W. Barbosa - 03-26-2014 12:00 AM



User(s) browsing this thread: 11 Guest(s)