Talk:First perfect square in base n with n unique digits: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→analytically determine minimum start value: You are right, I am wrong) |
m (→any ideas of optimizations ?: check runtime for base 22) |
||
Line 57: | Line 57: | ||
Obviously 2n+1 -> 2(n+1)+1 = (2n+1)+2<BR> |
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. |
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 |
But the addition has mainly halve 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 // 15588232346256352156349976289dec |
|||
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 ?== |
==Space compression and proof ?== |