Math loop but solves when x is correct

53 Views Asked by At

Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.

1

There are 1 best solutions below

4
On BEST ANSWER

The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).

INPUT $x$

Label (A)

If $x=1$ GOTO (A)

If $x \neq 1$ GOTO (B)

Label (B)

OUTPUT $3$

END