MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / liouvilleFunction

Function liouvilleFunction

Maths/LiouvilleFunction.js:20–25  ·  view source on GitHub ↗
(number)

Source from the content-addressed store, hash-verified

18
19import { PrimeFactors } from './PrimeFactors.js'
20export const liouvilleFunction = (number) => {
21 if (number <= 0) {
22 throw new Error('Number must be greater than zero.')
23 }
24 return PrimeFactors(number).length % 2 === 0 ? 1 : -1
25}

Callers 1

Calls 1

PrimeFactorsFunction · 0.90

Tested by

no test coverage detected