[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> fast power again



some of yopu know that i am not only a logo enthusiast,
but also a spreadsheet buff.

so here is a spreadsheet technique
to calculate he number of multiplications needed 
for fast power calculation

the first column gives the exponent,
the second column gives the number of multiplications needed


start the sheet by entering the folling numbers: 
2  1
3
4
5
.
.
.

and then in cell b2 enter the forlula
=IF(MOD(A2,2)=0,1+LOOKUP(A2/2,$A$1:A1,$B$1:B1),
1+LOOKUP(A2-1,$A$1:A1,$B$1:B1))

it is very important to get the $ signs right.

copy down the formula
and that's it.

erich neuwirth

by the way:
the technique used here with lookup is a very genreal technique
to calculate a lot of recursive functions in spreadsheets.







--
Erich Neuwirth <neuwirth@smc.univie.ac.at>
Computer Supported Didactics Working Group, Univ. Vienna
Visit our SunSITE at http://sunsite.univie.ac.at



---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home