Post Go back to editing

# KCC's Quizzes AQQ248 about a funny function

Dear Brainstormers,

After a quite long pause (the previous quiz was on November 2d), a new challenge is there as AQQ248:

A mathematician has created a special function that is defined in the integer set S from -9 to +9.

He disclose only few indications and values of that function:

The function is symmetric: F(-n) = F(n)

F(3) = 9

F(4) = 5

F(5) = 3

F(6) = 3

F(8) = -2

F(9) = -7

Question:

Can you crack that function and gives all the missing values (i.e. F(0); F(1); F(2) and F(7)?

Good luck!

• One of the possibilities is to use the "Lagrange's interpolation" (see Wikipedia or ChatGPT),
The standard method has to be lightly modified to satisfy the symmetry about 0  (f(x)  = f(-x)) which can be done simply by squaring the "li" (the i-th polynomial of the Lagrange's basis), or by using the absolute value of the argument.

But while this approach works for any x between -9 and +9  (the domain)  the image, or the result if you prefer, is not between -9 and +9.

So my question: is it only the domain which is between -9 and +9   or does the image (the result) too must be between -9 and +9 ?

If that constraint is only on the domain, not on the result, then the "classical" answer using Lagrange's interpollation is:
F(0) = -88
F(1) = -13.666666....
F(2) = 8.4
F(7) = 2.06666666....

• Note:  the polynomial equation is:  11x5/360319x4/360+3487x3/36017801x2/360+2299x/2088   ( if you want check that it gives the required results at the given points). I used a Lagrange Interpolation calculator (on line) to get the polynomial equation (and Excel, for the numerical results in my first part).
Again, this is assuming that the result is not required to give a value between -9 and +9  for x between -9 and +9.

• Eventhough the information is embedded in the quiz description, both the inputs and outputs are inside the set S (thus from -9 and +9). In addition, the S contains only integers

• The information is in fact embedded in the quiz: the unknown function operates only with integer numbers from -9 to +9. This, both for input and output values....

• Answer: F(0)=0, F(1)=F(-1)=1, F(2)=F(-2)=4, F(7)=F(-7)=5

If you consider nvs the given function values, you see there is a pattern:

F(9) = 81 - 88 = -7

F(8) = 64 -66 = -2

F(6) = 36 - 33 = 3

F(5) = 25 - 22 = 3

F(4) = 16 - 11 = 5

F(3) = 9 - 0 = 9

so F(n) = n- m, where m= 10*a + a and a is the 10x digit of n2 (in S you can always think at n2 = 10*a + b)

• You won’t like me on this one.

Lagrange’s ghost appeared to me with a solution:  use the binary representation if you deal with integers!  (Or maybe it was Walsh’s ghost, the guy from signal analysis, … not sure).

Anyhow, then the answers to your questions are 0  for all integers except the ones you forced to be nonzero, if we use the following equation (which seems to respect all the requirements):

F(x) = b0b1q2q3F(3) +q0q1b2q3F(4) +b0q1b2q3F(5) + q0b1b2q3F(6) + q0q1q2b3F(8) +b0q1q2b3F(9)

You recognize F, the function you gave, and the values you also supplied. What are the q and b?
For a given x, find its binary representation, b3, b2, b1, b0, and their negation, q3, q2, q1, q0,
Multiply these 0 and 1 together as specified. As example, for x = 3, will we have all four values of b0b1q2q3  nonzero. So, F(3)  will only be in the sum if and only if x=3. Same thing for the other values. More a “selector” and an “interpolator”, I agree, but using base 2 digits, if base 10 digits are allowed to be used, then why not?

I also tried to weight the bit representations, (before that this time it would be Gauss’ ghost getting mad at me) instead of weighting the known function values (at given points) as in the Lagrange’s method, but in base 2 I don’t have enough unknown weights (5 max)  to satisfy the number of equations ( the 6 forced conditions on F(xi) ). In base 3 though, just enough unknowns weights  ( F(x) = w +w0t0 + w1t1  + w00t02 + w11t12 + w01t0t1;  t0 and t1 being the digits of x in base 3), up to the point where, with the solution that I got, I evaluated F(1) which felt outside the allowed range.

• Further inspiration, instead of hoping that my interpolation will fall between -9 and +9, why not FORCING it to be between -9 and 9 by supplying a value for F(0), F(1), F(2) and F(7). I did so, forcing those to be zero (could have used other values in the range), and I got:

F(b0 + 2b1 + 4 b2 + 8b3) = 5b2 -2b3 +9b0b1 -2b0b2 -5b0b3 -2b1b2 -10b0b1b2.

Note that there is no implication of the negation of any bit. It gives the exact integer result for the fixed condition and returns 0 for each unspecified ones (F(0), F(1), F(2) and F(7)) (like the selector I previously supplied).

Now, about how to get these coefficients: We follow Gauss’ interpolation with:

F = w0b0 + w1b1 + w2b2 + w3b3 + w01b0b1 + w02b0b2 + w03b0b3 +w12b1b2 + w012b0b1b2

And then, impose the 9 conditions (F(0)=0 is automatically checked,  F(1)=0,  F(2)=0,  F(3)=9, etc.) which gives 9 LINEAR equations to solve for the 9 w.  (To solve by hand, proceed successively with F(1), F(2), F(4), F(8), F(3), F(5), F(9), F(6) and finally with F(7) ).

Note: In base 2,  bi  and bibi  ( or bi2)  are linearly dependent. So must use product bibj or bibjbk, etc., to add new linearly independent w.

• Bravo Gaetano! You succeed to crack the hidden algorithm, congratulations!

• I understand. But the function F have already values defined for F(9), F(8) etc... They cannot be forced to become 0....

• OK guys, it's time to give the solution....

It is not evident to crack this enigma. Not sure if it exists mathematical equations to solve this. The only way seem to guess and try until the assumtion made match with the given values...

Solution:
The trick is you scare the number and then you make a subtraction of the unit
digit by the second digit. If the square result is a single digit, consider the
number as 0x.
Verification:
F(3) : 3² = 9 = 09, hence 9-0 = 9 F(4) : 4² = 16, hence 6-1 = 5
F(5) : 5² = 25, hence 5-2 = 3 F(6) : 6² = 36, hence 6-3 = 3
F(8) : 8² = 64, hence 4-6 = -2 F(9) : 9² = 81, hence 1-8 = -7
The missing values:
F(0) : 0² = 0 = 00, hence 0-0 = 0 F(1) : 1² = 1 = 01, hence 1-0 = 1
F(2) : 2² = 4 = 04, hence 4-0 = 4 F(7) : 7² = 49, hence 9-4 = 5

A big applause to Gaetano Piarino ( ) who is the only one having cracked this quiz!

Be ready for the next coming challenge!