Contribution on Puzzlet #148

From:  Colin Elphick [celphick@netspace.net.au
]

What about 1!  ?

openconsole
color 15,0
autodefine "off"
 
uint i
i = 1
double x
x =0.0
 
do
 x = x + log10(i)
 if (i = int(x)+1)
  print rtrim$(str$(i))+"!"
 endif
 i = i + 1
until i<int(x)+1
 
locate 25,35 : print "Finished.",
do : until inkey$<>""
closeconsole
end

 
You're right, Colin - 1 is a legitimate answer.  I ignored this at my peril, regarding it as trivial!

More interestingly, your solution is much more elegant than mine.  I'm kicking myself, because I've used logs in a recent Puzzlet to determine a number's length, but never thought of doing it here. 

That meant I had to actually generate each factor and then figure out its length, and generating those VLI's (very long integers) is hard work in Basic.

All's well that ends well, though; Colin saw my function for generating VLI's and is going to use it for something else he's working on.

Congratulations on a really good contribution.

Dave.



MAIN MENU
CONTRIBUTIONS

Site design/maintenance: Dave Ellis E-mail me!
Last Updated: July 10th, 2005.