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

Function is_happy

ch1-c-threads/happycoin.c:26–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26bool is_happy(uint64_t num) {
27 while (num != 1 && num != 4) {
28 num = sum_digits_squared(num);
29 }
30 return num == 1;
31}
32
33bool is_happycoin(uint64_t num) {
34 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