Define a function sumof3sq which takes an integer and checks whether it can be expressed as the

sum of 3 squares. For instance, 33 = 4

2 + 4

2 + 1

2 in standard SML

It kind of looks like you’re seeking help with homework. If that’s true, not a problem, but please state it explicitly.

1 Like

Define a function sumof3sq which takes an integer and checks whether it can be expressed as the sum of 3 squares. For instance, 33 = 42 + 42 + 12.

- sumof3sq;

val it = fn : int → bool - sumof3sq 6;

val it = true : bool - sumof3sq 7;

val it = false : bool

it has to take a number , check if it is possible for that number to be represented as sum of three squares and give true or false(boolean).

@boreddy110 This isn’t the place to ask for solutions to random coding problems, especially (as Glenn says) without explicitly stating the context. Please use some other space for that. These forums exist to discuss Exercism exercises, the platform, or wider questions about programming