A Pretti number is a seven-digit positive integer with the following properties:

- The integer formed by its leftmost three digits is a perfect square.
- The integer formed by its rightmost four digits is a perfect cube.
- Its ten thousands digit and ones (units) digit are equal.
- Its thousands digit is not zero.

How many Pretti numbers are there?
Since a Pretti number has 7 digits, it is of the form $a b c d$ efg.

From the given information, the integer with digits $a b c$ is a perfect square.

Since a Pretti number is a seven-digit positive integer, then $a>0$, which means that $a b c$ is between 100 and 999, inclusive.

Since $9^{2}=81$ (which has two digits) $10^{2}=100$ (which has three digits) and $31^{2}=961$ (which has three digits) and $32^{2}=1024$ (which has four digits), then $a b c$ (which has three digits) must be one of $10^{2}, 11^{2}, \ldots, 30^{2}, 31^{2}$, since $32^{2}$ has 4 digits.

From the given information, the integer with digits defg is a perfect cube.

Since the thousands digit of a Pretti number is not 0 , then $d>0$.

Since $9^{3}=729$ and $10^{3}=1000$ and $21^{3}=9261$ and $22^{3}=10648$, then defg (which has four digits) must be one of $10^{3}, 11^{3}, \ldots, 20^{3}, 21^{3}$, since $22^{3}$ has 5 digits.

Since the ten thousands digit and units digit of the original number are equal, then $c=g$. In other words, the units digits of $a b c$ and defg are equal.

The units digit of a perfect square depends only on the units digit of the integer being squared, since in the process of multiplication no digit to the left of this digit affects the resulting units digit.

The squares $0^{2}$ through $9^{2}$ are $0,1,4,9,16,25,36,49,64,81$.

This gives the following table:

| Units digit of $n^{2}$ | Possible units digits of $n$ |
| :---: | :---: |
| 0 | 0 |
| 1 | 1,9 |
| 4 | 2,8 |
| 5 | 5 |
| 6 | 4,6 |
| 9 | 3,7 |

Similarly, the units digit of a perfect cube depends only on the units digit of the integer being cubed.

The cubes $0^{3}$ through $9^{3}$ are $0,1,8,27,64,125,216,343,512,729$.

This gives the following table:

| Units digit of $m^{3}$ | Possible units digits of $m$ |
| :---: | :---: |
| 0 | 0 |
| 1 | 1 |
| 2 | 8 |
| 3 | 7 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 3 |
| 8 | 2 |
| 9 | 9 |

We combine this information to list the possible values of $c=g$ (from the first table, these must be $0,1,4,5,6,9)$, the squares between $10^{2}$ and $31^{2}$, inclusive, with this units digit, and the cubes between $10^{3}$ and $21^{3}$ with this units digit:

| Digit $c=g$ | Possible squares | Possible cubes | Pretti numbers |
| :---: | :---: | :---: | :---: |
| 0 | $10^{2}, 20^{2}, 30^{2}$ | $10^{3}, 20^{3}$ | $3 \times 2=6$ |
| 1 | $11^{2}, 19^{2}, 21^{2}, 29^{2}, 31^{2}$ | $11^{3}, 21^{3}$ | $5 \times 2=10$ |
| 4 | $12^{2}, 18^{2}, 22^{2}, 28^{2}$ | $14^{3}$ | $4 \times 1=4$ |
| 5 | $15^{2}, 25^{2}$ | $15^{3}$ | $2 \times 1=2$ |
| 6 | $14^{2}, 16^{2}, 24^{2}, 26^{2}$ | $16^{3}$ | $4 \times 1=4$ |
| 9 | $13^{2}, 17^{2}, 23^{2}, 27^{2}$ | $19^{3}$ | $4 \times 1=4$ |

For each square in the second column, each cube in the third column of the same row is possible. (For example, $19^{2}$ and $11^{3}$ give the Pretti number 3611331 while $19^{2}$ and $21^{3}$ give the Pretti number 3619 261.) In each case, the number of Pretti numbers is thus the product of the number of possible squares and the number of possible cubes.

Therefore, the number of Pretti numbers is $6+10+4+2+4+4=30$.