MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / sumDigitsSquared

Function sumDigitsSquared

ch3-happycoin/happycoin-piscina.js:10–18  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

8}
9
10function sumDigitsSquared(num) {
11 let total = 0n;
12 while (num > 0) {
13 const numModBase = num % 10n;
14 total += numModBase ** 2n;
15 num = num / 10n;
16 }
17 return total;
18}
19
20function isHappy(num) {
21 while (num != 1n && num != 4n) {

Callers 1

isHappyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected