IBM Research

PUZZLE   IBM-181

Computing a polynomial

IBM Research · Ponder This · 2013-05

IBM Ponder This #181 · May 2013

Define a program to be a list of commands, each command of the form Variable_1 <=- Variable_2 Operation constant or Variable_1 <=- Variable_2 Operation Variable_3 where operation can be either addition, multiplication or modulo.

Here is an example of a program which computes the function f(x) = 1+x+x^2+x^4 (modulo 2233393)

a=x*47518 b=a*a c=x+1 d=c+b e=b*b f=e+d g=f mod 2233393

Find another program which computes the same function which uses a multiplying two variables at most twice and its last two commands are: a multiplication of two variables and a modulo computation.

Solution

Best opened after a real attempt

To be added.