Talk:First perfect square in base n with n unique digits: Difference between revisions
Content added Content deleted
(→Optimization when no extra digit required: clearing for myself) |
|||
Line 365: | Line 365: | ||
val it : int = 1026753849 |
val it : int = 1026753849 |
||
</pre><br>which seems to save the expected two thirds time. This is a little trickier when an extra digit is required because you would have to check each extra digit separately (they would have different Digital Roots).<br>The sequence 1 4 9 7 7 9 4 1 9 1 4 9 7 7 9 4 1 9 1 4 can be produced as (n*n)%9 -> 1 4 0 7 7 0 4 1 0 1 4 0 7 7 0 4 1 0 1 4 for n = 1 to 10 with the usual 0 means 9.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 22:03, 27 May 2019 (UTC) |
</pre><br>which seems to save the expected two thirds time. This is a little trickier when an extra digit is required because you would have to check each extra digit separately (they would have different Digital Roots).<br>The sequence 1 4 9 7 7 9 4 1 9 1 4 9 7 7 9 4 1 9 1 4 can be produced as (n*n)%9 -> 1 4 0 7 7 0 4 1 0 1 4 0 7 7 0 4 1 0 1 4 for n = 1 to 10 with the usual 0 means 9.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 22:03, 27 May 2019 (UTC) |
||
: //after watering the garden <br> |
|||
the digital root of the square of start value n ( pandigital:all digits of [0..Base-1] ) is for even numbers always Base-1.<BR> |
|||
base 10: 0123456789 -> 09 18 27 36 45 -> 0 -> 9 <BR> |
|||
For odd numbers Base % 2 ( casting out 9 aka Base-1 the Base % 2 is left over)<BR> |
|||
base 9: 012345678 -> 08 17 26 35 4 -> 4 <BR> |
|||
Now you only use such n , that there dgt-root**2 is the dgt-root of a pandigital number. Aha!<br> |
|||
for base 9: dgt root of the square [0..8] = 0 1 4 1 0 1 4 1 0 .. 1 4 1 0 <br> |
|||
So you only use numbers with digit root 2 and 6<br><br> |
|||
Now base 15: dgt-root of pandigital value ist 7<br> |
|||
dgt root of the square: 0 1 4 9 2 11 8 7 8 11 2 9 4 1 .. 0<br> |
|||
So one has only to check every 14.th value.<b>Bravo</b>!<br> |