Talk:First perfect square in base n with n unique digits: Difference between revisions

m
→‎any ideas of optimizations ?: check runtime for base 22
m (→‎any ideas of optimizations ?: check runtime for base 22)
Line 57:
Obviously 2n+1 -> 2(n+1)+1 = (2n+1)+2<BR>
Its a pitty that "carry := 0;if num >= base then num := num-base;Carry=1; " are not optimized to cmove in freepascal, like C or freebasic do.
But the addition has mainly havehalve the lenght of base conversion.<BR>
I hardcoded startvalues for base 22 ( glaciel ) that runs in <b>35.529s</b> on TryItOnline
<pre>
start value first
sqrnum above 1023456789ABCDEFGHIJKL
start value 1023456789AF71694A3533 // 15588232346256352156349976289‬dec
N = sqrt(startvalue) 4F942523JK5 //124852842764017dec
results in
n = 4F94788GJ0F //124.853.426.667.963dec
-> sqr ->
102369FBGDEJ48CHI7LKA5 //15588378150732414428650569369dec
26.508s</pre>
It takes 583.903.946 long and short additions
 
==Space compression and proof ?==
Anonymous user