Tessellate S.T.E.M.S - Computer Science - School - Set 1 - Problem 3

The value of a function f ( i , j , k ) f(i, j, k) is defined using the following rules (if multiple rules apply, then the one at the top of this list is applied)

  1. If i > 10 i > 10 , f ( i , j , k ) = 0 f(i, j, k) = 0
  2. If j > 10 j > 10 , f ( i , j , k ) = f ( i + 1 , 1 , 1 ) f(i, j, k) = f(i+1, 1, 1)
  3. If k > 10 k > 10 , f ( i , j , k ) = f ( i , j + 1 , 1 ) f(i, j, k) = f(i, j+1, 1)
  4. Otherwise, f ( i , j , k ) = 1 + f ( i , j , k + 1 ) f(i, j, k) = 1 + f(i, j, k+1)

What is the value of f ( 1 , 1 , 1 ) f(1, 1, 1) ?


This problem is a part of Tessellate S.T.E.M.S.

10 720 1000 30

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Nirjhar Das
Dec 26, 2017

f(1,1,1)=1+f(1,1,2)=1+(1+f(1,1,3))=......=10+f(1,1,11)

f(1,1,11)=f(1,2,1) by cond. 3
Again, f(1,2,1)=1+f(1,2,2)=1+1+f(1,2,3)=......=10+f(1,2,11)

Once again by cond. 3, f(1,2,11)=f(1,3,1)

Thus for every i and j, k goes from 1 to 10, adding 1 to the output. Thus, for every i,j, value increases by 10. Observe that similarly, j goes from 1 to 10, before i increases. Thus, the function can be seen as loop as follows:

s=0;
for(i=1;i<=10;i=i+1){
for(j=1;j<=10;j=j+1){
for(k=1;k<=10;k=k+1){
s=s+1;
}
}
}

So i-loop runs 10 times, j-loop runs 10 times each for every value of i, and k-loop runs 10 times each for every value of j. Thus in total, s increases by 10* 10* 10=1000

This is exactly what we had in mind. Great job on decoding it!

By the way, in a functional programming language like Haskell, you can directly run this as it is: ideone

Agnishom Chattopadhyay - 3 years, 5 months ago

Log in to reply

Thank you sir. Actually this is classical recursive functions.

Nirjhar Das - 3 years, 5 months ago
Hasmik Garyaka
Jul 2, 2018

Function f is really a notation for numbers, when digits are written as 11-d

You mean in base 11?

Agnishom Chattopadhyay - 2 years, 11 months ago

Log in to reply

In base 10 but reversed. 10=0 1=9

Hasmik Garyaka - 2 years, 11 months ago

Log in to reply

This is interesting. Can you give some examples to illustrate your point, please?

Agnishom Chattopadhyay - 2 years, 11 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...