First perfect square in base n with n unique digits: Difference between revisions
First perfect square in base n with n unique digits (view source)
Revision as of 22:15, 5 December 2020
, 3 years agouses gforth built-in dec.r word
m (uses gforth built-in dec.r word) |
|||
Line 528:
=={{header|Forth}}==
<lang Forth>
#! /usr/bin/gforth-fast
: 2^ 1 swap lshift ;
Line 548 ⟶ 550:
dup sq pandigital? until ;
:
base @ 17 2 do
i base !
loop base ! ;
.squares
bye
</lang>
{{Out}}
<pre>
2 10² = 100
3 22² = 2101
Line 574 ⟶ 575:
14 3A9DB7C² = 10269B8C57D3A4
15 1012B857² = 102597BACE836D4
16 404A9D9B² = 1025648CFEA37BD9
</pre>
|