> But for teaching and other mathematical connections, > would it perhaps be better to use the (base 10 logarithm) > decimal logarithm to get the number of digits? > In python it is ceil(log10(n)) > > Can be used like this: > sage: from math import * > sage: n=123456789900000101202030405066778888 > sage: ceil(log10(n)) > 36.0
Actually the correct formula is floor(log10(n))+1. See below sage: ceil(log(100,base=10)) 2 sage: floor(log(100,base=10))+1 3 :-) Kwankyu --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to sage-edu@googlegroups.com To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en -~----------~----~----~----~------~----~------~--~---