Posted to tcl by kbk at Sat Jun 15 16:27:17 GMT 2019view pretty

proc facs {N} {
    set lnfac 0.
    for {set n 2} {$n <= $N} {incr n} {
	puts "n = $n"

	# accumulate log(n!)

	set lnfac [expr {$lnfac + log($n)}]
	puts [format {ln(n!) = %e n! = %g} $lnfac [expr {exp($lnfac)}]]

	# calculate log(b), and b itself

	set lnb [expr {$lnfac / $n}]
	set b [expr {entier(ceil(exp($lnb)))}]
	puts [format {ln(b) = %e b = %g} $lnb $b]

	# format n! in floating point - with excess precision, but who cares

	set lognfac [expr {$lnfac/log(10.)}]
	set charnfac [expr {int($lognfac)}]
	set signfac [expr {10.**($lognfac - $charnfac)}]
	puts "$n! = ${signfac}E${charnfac}"

	# format b**n in floating point, again with excess precision

	set logbton [expr {$n * log($b) / log(10.)}]
	set charbton [expr {int($logbton)}]
	set sigbton [expr {10.**($logbton - $charbton)}]
	puts "$b**$n = ${sigbton}E${charbton}"


facs 10000


Posted by CecilWesterhof at Sun Jun 16 11:21:55 GMT 2019 [text] [code]

I implemented the old fashioned way what I mend: Later I hope to implement your idea. By the way it was already at oeis: They have the list up-to 10.000. I am a 'little' further, so I will offer them my data.