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

Content added Content deleted
Line 554: Line 554:
base @ 17 2 do
base @ 17 2 do
i base !
i base !
cr i 2 d. 3 spaces panroot dup 10 .r ." ² = " sq .
cr i 2 d. 3 spaces panroot dup 8 .r ." ² = " sq .
loop base ! ;
loop base ! ;
</lang>
</lang>
Line 560: Line 560:
<pre>
<pre>
showsquares
showsquares
2 10² = 100
2 10² = 100
3 22² = 2101
3 22² = 2101
4 33² = 3201
4 33² = 3201
5 243² = 132304
5 243² = 132304
6 523² = 452013
6 523² = 452013
7 1431² = 2450361
7 1431² = 2450361
8 3344² = 13675420
8 3344² = 13675420
9 11642² = 136802574
9 11642² = 136802574
10 32043² = 1026753849
10 32043² = 1026753849
11 111453² = 1240A536789
11 111453² = 1240A536789
12 3966B9² = 124A7B538609
12 3966B9² = 124A7B538609
13 3828943² = 10254773CA86B9
13 3828943² = 10254773CA86B9
14 3A9DB7C² = 10269B8C57D3A4
14 3A9DB7C² = 10269B8C57D3A4
15 1012B857² = 102597BACE836D4
15 1012B857² = 102597BACE836D4
16 404A9D9B² = 1025648CFEA37BD9 ok
16 404A9D9B² = 1025648CFEA37BD9 ok
</pre>
</pre>

=={{header|Go}}==
=={{header|Go}}==
This takes advantage of major optimizations described by Nigel Galloway and Thundergnat (inspired by initial pattern analysis by Hout) in the Discussion page and a minor optimization contributed by myself.
This takes advantage of major optimizations described by Nigel Galloway and Thundergnat (inspired by initial pattern analysis by Hout) in the Discussion page and a minor optimization contributed by myself.