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

Function is_happy

ch1-c-threads/happycoin-threads.c:32–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32bool is_happy(uint64_t num) {
33 while (num != 1 && num != 4) {
34 num = sum_digits_squared(num);
35 }
36 return num == 1;
37}
38
39bool is_happycoin(uint64_t num) {
40 return is_happy(num) && num % 10000 == 0;

Callers 1

is_happycoinFunction · 0.70

Calls 1

sum_digits_squaredFunction · 0.70

Tested by

no test coverage detected