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

m
→‎{{header|Python}}: (removed an unused function)
m (→‎{{header|Python}}: (docstring edit))
m (→‎{{header|Python}}: (removed an unused function))
Line 354:
<lang python>'''Perfect squares using every digit in a given base.'''
 
from math import (ceil, sqrt)
from itertools import (count, dropwhile, repeat)
from math import (ceil, sqrt)
from time import time
 
Line 372:
# missingDigitsAtBase :: Int -> [Bool] -> Int -> Bool
def missingDigitsAtBase(base, bools):
'''Fusion of representing the square of integer N at a given base
with checking whether all digits of that base contribute to N^2.
Clears the Boolbool at a digit position to False when used.
True if allany positions haveremain been cleareduncleared (usedunused).
'''
def go(x):
Line 439:
wrap(toChr, n, rs)
)
 
 
# untilSucc :: (a -> Bool) -> a -> a
def untilSucc(p):
'''The result of repeatedly testing the next
ordinal value until p holds.
'''
def go(x):
v = x
while not p(v):
v = 1 + v
return v
return lambda x: go(x)
 
 
9,655

edits