History of powers beyond squares and cubes The ancient Babylonians understood squares:



 
 
 
Plimpton 322

The ancient Athenians understood cubes, if we can take
doubling the cube, i.e., the Delian problem, as evidence.
My question is:

Q. When were 4th, 5th, $\ldots$, $n$-th powers contemplated/understood/used?

I am wondering how tied was the understanding of powers/exponentiation
to geometry, to spatial dimensions. Did the ancients generalize their
explorations to arbitrary integer exponents?
 A: Wikipedia's article on the Mother Goose rhyme "As I was going to St. Ives" suggests that curiosity about higher powers has existed a long time.
The Rhind Mathematical Papyrus (Problem 79), dated to around 1650 BC, could be described with the following text:

There are seven houses;
In each house there are seven cats;
Each cat catches seven mice;
Each mouse would have eaten seven ears of corn;
If sown, each ear of corn would have produced seven hekat of grain.
How many things are mentioned altogether?

Edit: Interestingly, the $7^5$ hekat of grain here are counterfactual (imagined, not actually existing); as is perhaps the very notion of a number like $7^5$, to the author of the papyrus.
A: The cuneiform tablet MS 2351 from the 19th century BC contains the 15-digit sexagesimal number 13 22 50 54 59 09 29 58 26 43 17 31 51 06 40, which happens to equal $20^{20}$. I also seem to remember they constructed a table of reciprocals for numbers of the form $125 \cdot 2^n$ for exponents up to $19$.
Edit. Last year some fragments of a large table have been identified:
Ossendrijver discovered that the complete table contained the powers of 9 up to $9^{46}$.
A: The first definition of the powers beyond the third is probably in Diophantus' Arithmetica (written somewhere from 100 BC to 300 AD). 
In the introduction to that work, he defines fourth powers (δυναμοδύναμεις "dynamodynameis", lit. "square-squares"), fifth powers (δυναμόκυβοι "dynamokuboi", lit. "square-cubes"), and sixth powers (κυβόκυβοι "kubokuboi", lit. "cube-cubes"). Throughout the course of the work, he uses all of these powers. Moreover, he assigns them no geometrical significance whatsoever, just as he doesn't think of squares and cubes themselves in a geometric way; e.g., he sees no problem in adding the square of the unknown to a constant, etc.
Edit: After writing the above, I checked up on Sir Thomas Heath's great treatise on Diophantus. Apparently, Heron used the same term for the fourth power as Diophantus. Since Diophantus' dates are somewhat uncertain, he may or may not have been anticipated by Heron. 
A screenshot from Heath's book:

A: Just for the record, I thought this passage from Omar Khayyam's algebra book (p.49) should be here. In particular, it shows how hard it was to to tie  the understanding of powers to geometry

I say: what algebraists call square-square is an imaginary concept in
  continuous quantities. It has no existence in any way in materialistic
  objects. For continuous quantities, the terms square-square,
  square-cube and cube-cube are used to denote the number (coefficient)
  of the object (variable)... The things that algebraists use to denote objects and quantities are:
  number, root, square and cube. The number has to be taken as an
  abstract concept. It has no existence unless it is individuated by
  things...
  Square-square, which, to the algebraists, is the product of the square
  by itself, has no meaning in continuous objects. This is because how
  can one multiply a square, which is a surface, by itself? Since the
  square is a two-dimensional object (geometrical figure), and
  two-dimensional by two-dimensional is a four dimensional object. But
  solids cannot have more than three dimensions. All objects in algebra
  are generated from these four genera. And anyone who says that algebra
  is a trick to determine unknown numbers is wrong. So don’t pay
  attention to these people. It is true that algebra and equations are
  geometrical things...

Edit. René's post and Joël's comment gave me some new insight about Khayyam's understanding of powers higher than three. Of course, he was aware of them as he explains how a certain equation of power 4 can be solved: 

Now, whoever said: square-square plus three squares equals
  twenty-eight; he halved the squares then multiplied it by itself and
  then added the number; and took the root of the result to equal five
  and a half; then subtracted half the squares to get four which the
  square, and the square of the square is sixteen...

But, for him algebra and equations were attached to geometry. Apart from number that "has to be taken as an abstract concept", $x$ , $x^2$, and $x^3$ had  geometrical meaning, side, square , and cube, respectively. Thus, immediately after mentioning the solution of the equation above, he warns the reader as follows:  

...and he thought that he deduced the square of the square using
  algebra: is very feeble in his thinking. This is because he did not
  deduce the square of the square but rather he deduced the square.It is exactly as if he said: square plus three roots equals twenty-eight, then he determined the root using the second reduction, and concluded that the square of this root is the square of the square, which is a secret from which you will come to know other secrets. 

All in all, it is a good example of how a "philosophical" belief could impede the advance of knowledge even for such an intelligent mind.  
