Post Reply 
Programming Exercise (HP-15C, 15C LE - and others)
03-26-2014, 02:22 AM
Post: #36
RE: Programming Exercise (HP-15C, 15C LE - and others)
(03-26-2014 12:00 AM)Gerson W. Barbosa Wrote:  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

Do this change: for no get error "Divide by zero" (well, this error but in spanish)
for n=5000 to 2 step -1

get suma= 0.999800000 in about 3 sec

if change to
for n=10000 to 2 step -1
get suma= 0.999900000 in 5.5 sec
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) - churichuro - 03-26-2014 02:22 AM



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