Talk:First perfect square in base n with n unique digits: Difference between revisions
Talk:First perfect square in base n with n unique digits (view source)
Revision as of 15:11, 25 May 2019
, 4 years ago→analytically determine minimum start value: Argh. pasted in wrong version. fixed
Thundergnat (talk | contribs) |
Thundergnat (talk | contribs) (→analytically determine minimum start value: Argh. pasted in wrong version. fixed) |
||
Line 190:
Note: I would not have figured this out without the above analysis by Hout and Nigel Galloway. Kudos to both of them.
Here is a Perl 6 script showing each step spelled out: [https://tio.run/##fVNNb9owGL7zK56iaARGrNJJrQYqnaZddthp2mmslQNvwFNiZ3ayFqH0R@26W/8Ys@MECJWWAzHO@77Phx/npNPr/d6UMVZiLQqeRlqpAmFQv4TBUuXbMaZBzA0NsevBPv7jrX@zpcpilvE83E3fXYfBw7AaMlNmzHWETd/jRqTU1m@4NphjMjsOY7ndo@ikZdarej3HKxHaFJH5VXJNCD/LAoFsiRi@xWA0wBNu3s8OO/2PdoCtQhThmyGDYkPIlTEitiRqnWbaP9ZnW3wwBddOUpLyAoPJYIzBpf0Jr8DYvUN8@dsIkpbaEWohP3nfUHuiEgumzAEF/XFdayG8aRbi1OgQ4X13OPuphLSGt//xHzjj8ch75BTLMovJuiskYm/CuVDfd2uVMebg3MGNXv7Uiyl2XXbBw4FXhxKqLqkvQoqszGxzkpAmuSTHbBfIKqrneXMSrTIoSa9Yrzqa5t6qlrizTiWJIXc8mZChl8DWmizhEeZNDi2ryK8abrkWLiyH3nY1d5B3d7jExUW7eX62Ijkpv2zSdhAMhLsa6W1TVLXQR5jhQi7kVzWGzRN3vJ1B41q3yXiakpVeh07INX7ztCQ8ijSFJFqBS9BToXk7rLHCPT6p3yct9I8TZc@vv/rGCpTaNJzJ8AwhVQPmMwuzUWW6QkyWy5KM4XrLGgLVyam3Z@5vTq3Axb2hUMfYmmk72JvOFU6UxuTGXitcTWb7/T8 Try it online!]
<pre>sub digital-root ($root is copy, :$base) {
Line 209:
say "\nMinimum difference of {$n}-digit root from one of the first $n digital roots > $root:";
my $offset = min(@roots.grep: * >= $root ) - $root;
print $offset = $offset > $n ?? 0 !! $offset.base($n);
if $offset > 0 {
say " ({$root+$offset} - $root = $offset)\n\nSo, at a minimum, the smallest starting value will need an extra $offset";
@start[1+$offset] = $offset ~ @start[1+$offset];
Line 266:
Minimum difference of 19-digit root from one of the first 19 digital roots > 9:
0
So no extra digits should be necessary.
Minimum start value:
*******************************************************************************
Base 20 -- Uses the possible digits:
|