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

Content added Content deleted
(Added comment about using congruence formula to calculate digital root.)
(pointed out correction for pascal version)
Line 390: Line 390:


:::Thanks for pointing out that I could use the congruence formula to simplify (and possibly quicken up) the calculation of the digital root which is used to help establish the optimum starting value for each base. Unfortunately, I haven't been able to use it as I wasn't able to obtain consistently faster times than before. Although it was marginally faster up to base 25, it then started to diverge and by the time base 28 was reached it was 48 seconds slower than before. This may be due to the vagaries of big.Int arithmetic in Go but thanks anyway for continuing to think about this task which has been a real team effort :) --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 19:50, 2 June 2019 (UTC)
:::Thanks for pointing out that I could use the congruence formula to simplify (and possibly quicken up) the calculation of the digital root which is used to help establish the optimum starting value for each base. Unfortunately, I haven't been able to use it as I wasn't able to obtain consistently faster times than before. Although it was marginally faster up to base 25, it then started to diverge and by the time base 28 was reached it was 48 seconds slower than before. This may be due to the vagaries of big.Int arithmetic in Go but thanks anyway for continuing to think about this task which has been a real team effort :) --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 19:50, 2 June 2019 (UTC)

==Minimum start for Pascal version==
I spotted a bug in the output of the extended Pascal version, for the value of base 17. The values should be
<pre>423F82GA9 101246A89CGFB357ED</pre> rather than <pre>4261CBG65 102369EB54FD9G7CA8
</pre>Looking into the code, it seems that although it correctly identifies which bases need an extra digit, the current Pascal code always adds a zero to the end. That is, it multiplies the minimum start value by the base. What other implementations do is to identify what digit should be added, and the location in the minimum start value where that digit should be added. I've made a [https://tio.run/##3Vl7b9tGEv@fn2KQK2DSoR6UXLeVYgO2Zbe6JlIuVuPeBYFBkStpbYqUuUu7TpGvXnf2RXIl2XHuUKA4wbbI3ZnZef52dp1Nr0jEG6uQRWHSmK2ih4dVns3zcAn4LeaCvtNqndE0Br4gwJZhkhDGIS2WU5JDCjyDacgITH1gGdKEOLebAk2jpIgJA6RHATGdU84gm2liCK9DWIWpHA8T5/dvhmeD0zM4e3vy2QH4/Zs348EpDE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Lt/z3s@Jbcat@ptdJ47sCzPoeCkVhf0sjxslasW4crWdQiYs2nLuVqzOZx/A7cANgiqbELnLgyl1oCIzSxcdiZYZHFdmBEWW358bvTo59NaFPyGze3NirtnS9l2tageTZs4RFLqUNVIYLSqrMHDQi88qhvYkD9fwQKQlRnPwsT1dZXGSBqgdpRnwQ1uLkQgpLUdSdBg7fB2/1@f6/d7v3Q6/o7wNQFqb6pNaboV2lklRBJarBTYePEuvc1F2LplttMrcGOpNi43DcPytlu6kEVecwKpeGkZpHIHnP7Jiur863JlxLL62q7LjI2JsbyoK1MJ1gVsXaA@bfNxXA0GF@cf0ZgjtHe8l8zaHfz4eGPaJaEc/bQGHf/BA Try It Online! link ] with a kludgy fix. It is hard-coded to stop at base 25, as one only gets 60 seconds to execute there.--[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 20:06, 6 June 2019 (UTC)