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

m
m (→‎{{header|Haskell}}: Applicative formulation of `digits` turns out, FWIW, to be a little faster.)
Line 801:
digits :: Integral a => a -> a -> [a]
digits b = unfoldr
b = unfoldr
(((>>) . guard . (0 /=)) <*> (pure . ((,) <$> (`mod` b) <*> (`div` b))))
sequenceForBaseN :: Integral a => a -> [a]
Line 828 ⟶ 829:
(display b n)
Nothing -> pure ())
[2 .. 1612]
where
squareRootValue = round . sqrt . realToFrac</lang>
9,655

edits