3 added 8 characters in body

Jelly, 1515 14 bytes

24p;€$€;/24p;€$€Ẏ
ḅ70ị¢


Finally, we use ;/Ẏ to flatten the list by one stage, in order to get a list that simply contains all the coordinates in order. It starts like this:

24p;€$€;/ ḅ70ị¢  Finally, we use ;/ to flatten the list by one stage, in order to get a list that simply contains all the coordinates in order. It starts like this: Jelly, 15 14 bytes 24p;€$€Ẏ
ḅ70ị¢


Finally, we use Ẏ to flatten the list by one stage, in order to get a list that simply contains all the coordinates in order. It starts like this:

2 typo fix, plus a bit of additional explanation to fulfil the edit size limit

We start by converting the input coordinates to a number by interpreting them as a base 70 integer: ḅ70. This gives us a value in the range 71 to 4970 inclusive; all these values are unique mod 4900. ị indexes into the list modulo the length of the list, so [1, 1] will give us the 71st element, [1, 2] the 72nd element, all the way up to [70, 70] which gives us the 80th70th element (i.e. the element before the answer for [1, 1]). Finally, we just need a ¢ to tell us which list to index (in this case, it's the list specified by the previous line; that's what ¢ does, run the previous line with no arguments).

We start by converting the input coordinates to a number by interpreting them as a base 70 integer: ḅ70. This gives us a value in the range 71 to 4970 inclusive; all these values are unique mod 4900. ị indexes into the list modulo the length of the list, so [1, 1] will give us the 71st element, [1, 2] the 72nd element, all the way up to [70, 70] which gives us the 80th element. Finally, we just need a ¢ to tell us which list to index (in this case, it's the list specified by the previous line; that's what ¢ does, run the previous line with no arguments).

We start by converting the input coordinates to a number by interpreting them as a base 70 integer: ḅ70. This gives us a value in the range 71 to 4970 inclusive; all these values are unique mod 4900. ị indexes into the list modulo the length of the list, so [1, 1] will give us the 71st element, [1, 2] the 72nd element, all the way up to [70, 70] which gives us the 70th element (i.e. the element before the answer for [1, 1]). Finally, we just need a ¢ to tell us which list to index (in this case, it's the list specified by the previous line; that's what ¢ does, run the previous line with no arguments).

1

Jelly, 15 bytes

24p;€$€;/ ḅ70ị¢  Try it online! This is fairly simple: we construct the list of coordinates of cubes within the pyramid as an actual list. Then all we need to do is biject the input coordinates within the square into an index within the list, which is trivial to do via base conversion. This submission works either as a full program (taking the coordinates as [x, y] via the first command line argument and outputting on standard output), or as a function, implicitly named 2Ŀ. Explanation Constructing the list We start with the number 24, which is interpreted as a range from 1 to 24 inclusive (because we're trying to use it as though it were a list). Then we iterate over it; that's what the last € in the program does. For each element n of the list: • We construct the list of pairs x, y where each element comes from 1..n; p constructs a list of pairs given two sets of elements, and because only one value is available here (n), it's implicitly used for both sets, which both therefore become a list from 1..n. • We append n (again, the only value we have available) to each element of the list (;€). • In order to make the second € apply both of these operations to each n (i.e. to create a loop containing two instructions), we use $ to group the two instructions into one.

Finally, we use ;/ to flatten the list by one stage, in order to get a list that simply contains all the coordinates in order. It starts like this:

[1, 1, 1], [1, 1, 2], [1, 2, 2], [2, 1, 2], [2, 2, 2], [1, 1, 3], [1, 2, 3], [1, 3, 3], [2, 1, 3], [2, 2, 3], [2, 3, 3], [3, 1, 3], [3, 2, 3], [3, 3, 3], [1, 1, 4], [1, 2, 4], [1, 3, 4], [1, 4, 4], [2, 1, 4], [2, 2, 4], [2, 3, 4], [2, 4, 4], [3, 1, 4], [3, 2, 4], [3, 3, 4], [3, 4, 4], [4, 1, 4], [4, 2, 4], [4, 3, 4], [4, 4, 4], …

and ends with [24, 24, 24].

Indexing the list

We start by converting the input coordinates to a number by interpreting them as a base 70 integer: ḅ70. This gives us a value in the range 71 to 4970 inclusive; all these values are unique mod 4900. ị indexes into the list modulo the length of the list, so [1, 1] will give us the 71st element, [1, 2] the 72nd element, all the way up to [70, 70] which gives us the 80th element. Finally, we just need a ¢ to tell us which list to index (in this case, it's the list specified by the previous line; that's what ¢ does, run the previous line with no arguments).