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

Added Quackery.
No edit summary
(Added Quackery.)
Line 3,652:
 
c. 30 seconds.</pre>
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="Quackery"> [ dup 1
[ 2dup > while
+ 1 >>
2dup / again ]
drop nip ] is sqrt ( n --> n )
 
[ base share bit 1 -
0 rot
[ dup while
base share /mod bit
rot | swap again ]
drop = ] is pandigital ( n --> b )
 
[ base share
dup 2 - times
[ base share *
i^ 2 + + ] ] is firstpan ( --> n )
 
[ dup * ] is squared ( n --> n )
 
11 times
[ i^ 2 + base put
firstpan sqrt from
[ index squared
pandigital if
[ index end ] ]
decimal
say "Base "
i^ 2 + echo
base release
say ": "
dup echo
say "^2 = "
squared echo cr
base release ]
</syntaxhighlight>
 
{{out}}
 
<pre>Base 2: 10^2 = 100
Base 3: 22^2 = 2101
Base 4: 33^2 = 3201
Base 5: 243^2 = 132304
Base 6: 523^2 = 452013
Base 7: 1431^2 = 2450361
Base 8: 3344^2 = 13675420
Base 9: 11642^2 = 136802574
Base 10: 32043^2 = 1026753849
Base 11: 111453^2 = 1240A536789
Base 12: 3966B9^2 = 124A7B538609</pre>
 
=={{header|Raku}}==
1,462

edits