Are you thinking of the sum of the first N natural numbers?
I've heard the legend/story that he (Guass) came up with this when he was somewhere between 10 and 15 years old (for the record, I might have come up with this when I was 10, but cartoons were more interesting than math then).
It's quite possible that Gauss figured that out when he was
young. I actually figured it out when I was 8. Being a
young, anti-social kid, I tried adding numbers between 1
and as high as I could go, trying to find a pattern. The
funny part was that I didn't know what variables were,
although I did know fractions. My formula was something
like, "Take a number, add one, divide by two, and then
multiply it by half of the original number." It seemed
very strange to me that that formula seemed to hold for
any number I gave it. One day I even added all the numbers
up to 20 in my hand to see if I got 210.
Anyway, one day I told my math teacher that I figured out
this neat formula and then she introduced me to concepts
like "variables" and "functions". :)
Gauss did indeed figure this out at the age of 8 .. a teacher had given her unruly class the "busywork" problem of summing the first 100 integers.
Gauss is also notorious for catching errors in his father's bookkeeping at an even earlier age.
This from A Biography of Gauss