arithmoi-0.9.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2011 Daniel Fischer
LicenseMIT
MaintainerDaniel Fischer <daniel.is.fischer@googlemail.com>
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.Powers.Fourth

Description

Functions dealing with fourth powers. Efficient calculation of integer fourth roots and efficient testing for being a square's square.

Synopsis

Documentation

integerFourthRoot :: Integral a => a -> a Source #

Calculate the integer fourth root of a nonnegative number, that is, the largest integer r with r^4 <= n. Throws an error on negaitve input.

integerFourthRoot' :: Integral a => a -> a Source #

Calculate the integer fourth root of a nonnegative number, that is, the largest integer r with r^4 <= n. The condition is not checked.

exactFourthRoot :: Integral a => a -> Maybe a Source #

Returns Nothing if n is not a fourth power, Just r if n == r^4 and r >= 0.

isFourthPower :: Integral a => a -> Bool Source #

Test whether an integer is a fourth power. First nonnegativity is checked, then the unchecked test is called.

isFourthPower' :: Integral a => a -> Bool Source #

Test whether a nonnegative number is a fourth power. The condition is not checked. If a number passes the isPossibleFourthPower test, its integer fourth root is calculated.

isPossibleFourthPower :: Integral a => a -> Bool Source #

Test whether a nonnegative number is a possible fourth power. The condition is not checked. This eliminates about 99.958% of numbers.