|
(This is in response to the post of 15 Sept. 2004.)
To count the number of digits of a number in the form a^n, try this QBASIC
program:
CLS : PRINT "Program to calculate the number of digits of a^n":
PRINT
DO: a = 0: n = 0 WHILE a <= 0 OR a <> INT(a): INPUT "What is the (positive integer) base, a"; a: WEND WHILE n <= 0 OR n <> INT(n): INPUT "What is the (positive integer) power, n"; n: WEND digits = INT(n * (LOG(a) / LOG(10))) + 1 PRINT : PRINT "Number of digits is"; digits PRINT "********************************": PRINT LOOP A full discussion of this appears on the REC Web site, http://beam.to/REC
Best, Mike
Michael W. Ecker, Ph.D. Dr. Mike Ecker, Editor-Publisher Recreational & Educational Computing* 187 Ferguson Ave./ Suite D Shavertown, PA 18708 * REC has been published continuously since Jan. 1986. http://members.aol.com/DrMWEcker/REC.html or http://beam.to/REC
(Dr. Michael W. Ecker is also Associate Professor of Mathematics, Pennsylvania State University, Wilkes-Barre Campus, Lehman, PA 18627.) |
_______________________________________________ Prime mailing list [EMAIL PROTECTED] http://hogranch.com/mailman/listinfo/prime
