JS&PHP,
вариант
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<script>
function factorial(a) {
var b = 0,
c = a;
return function d() {
if (1 == a || b > a - 2) return c;
b++;
c *= a - b;
document.write(a + " " + (a - b) + " " + c + " Hello<br>");
return d()
}()
};
document.write(factorial(9))
</script>
</body>
</html>