Carmichael's reduced totient λ(n) from the prime factorization (`n ≥ 1`).
(n: bigint)
| 1286 | const seen = new Set<bigint>(); |
| 1287 | let k = toBigint(n); |
| 1288 | // Happy numbers are positive integers; a negative `k` would also make |
| 1289 | // `sumSquareDigits` throw on the "-" sign. |
| 1290 | if (k === null || k < 1n) return ce.False; |
| 1291 | while (!seen.has(k)) { |
| 1292 | if (k === 1n) return ce.True; |
| 1293 | seen.add(k); |
| 1294 | k = sumSquareDigits(k); |
| 1295 | } |
| 1296 | return ce.False; |
| 1297 | }, |
| 1298 | }, |
| 1299 | |
| 1300 | IsAbundant: { |
| 1301 | description: 'True if n is an abundant number (sum of divisors > 2n).', |
| 1302 | signature: '(integer) -> boolean', |
| 1303 | evaluate: ([n], { engine: ce }) => { |
| 1304 | const k = toBigint(n); |
| 1305 | if (k === null || k < 1n) return ce.False; |
| 1306 | let sum = 1n; |
no test coverage detected