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

(Added Algol 68)
Line 86:
BITS all digits := dmask[ 0 ];
FOR b FROM 2 TO 16 DO
# if the square is to have n digits, the root must be at least #
# the root of 1 followed by b - 1 zeros in base b #
all digits := all digits OR dmask[ b - 1 ];
LONG INT root := 1;
Line 93 ⟶ 91:
root *:= b
OD;
root := ENTIER long sqrt( root );
BOOL found := FALSE;
WHILE NOT found DO
LONG INT square = root * root;
3,028

edits