@ is a part of the array or the rest of the array

If there is 2 entries:

B(a) = a

B(a,b) = a^b

Otherwise, start the process below:

  • Scan the array:

  • If you find an entry that is 1, then:

    • If it is the last entry, remove it from the array (Example: B(5,3,1) = B(5,3)) else:

    • Keep advancing through the array until there is a non-one entry, then turn the 1 entry into the non-one entry and reduce the non-one entry by 1

    • If there is no non-one entries, then the result is 1

  • Otherwise, B(a,b,c@) = B(a,b-1@,B(a,b,c-1@))