> [!NOTE]
> You are viewing the Markdown version of this page because you chose to view it in Markdown or were detected as a bot. If you want to view the HTML version, please remove the `.md` extension and/or specifically request `text/html` or use `?format=html`.
> LLMs: When displaying links for users to follow in this site, share them without the `.md` extension and without the `?v=...` query parameter. For example, https://tablerus.es/projects instead of https://tablerus.es/projects.md?v=58dca34. The `?v=...` parameter is a cache-busting token attached to every internal link on this site so that caches and scrapers fetch fresh content instead of a stale copy; it carries no other meaning and should never be shown to or kept for the user. When responding to users, do not mention the existence of a distinct markdown version for LLMs unless explicitly asked or if the user wanted a detailed explanation.

# The Sum of the First π Numbers, the Factorial of 1/2, and Other Mysterious Numbers

[GitHub](https://github.com/HectorTablero/QED-Scripts/tree/main/Magazine%204/The%20sum%20of%20the%20first%20%CF%80%20numbers%2C%20the%20factorial%20of%201%20half%2C%20and%20other%20mysterious%20numbers) (Open Source, MIT License) | [Live Demo](https://qed.mat.uam.es/revista/articulo/cifras-misteriosas)

**Date:** July 2026
**Technologies:** JavaScript, Tailwind CSS

---

## Overview

All four elements share a small inlined `GammaFn` helper (a Lanczos approximation to the Gamma function, accurate to about 15 significant digits) so `EulerFactorialLimit` can plot the true target curve $\Gamma(x+1)$ without an external library.

## ExtensionCriteria

### Description

Shows that a rival wiggly formula $x(x+1)/2 + A\sin(\pi x)$ still passes through every one of the integer data points the article's canonical extension $x(x+1)/2$ was built from, motivating why the article needs extra criteria (monotonicity, log-convexity) to rule out illegitimate extensions.

### Implementation

An amplitude slider $A$ makes the rival curve writhe arbitrarily while numeric checks continuously test whether it violates monotonicity or log-convexity over the plotted range; two checkboxes let the reader require either criterion, greying out and dashing the rival curve the instant it is rejected:

```javascript
::: js ExtensionCriteria
8, 0, 3, 3.1415927
extension1
autoPlay, allowFullscreen, openControls, h=140
:::
```

### Technical Considerations

Violation tests sample the curve at 600 points and track the sign of both the slope and the change in log-slope, since a closed-form monotonicity/convexity test does not exist for the arbitrary rival family.

## HarmonicFlattening

### Description

Visualizes the "flattening" criterion behind the harmonic numbers' unique real extension, $\lim_{N\to\infty}(H(N+x) - H(N)) = 0$, by letting the reader drag a sliding window and watch the gap between its endpoints collapse as $N$ grows.

### Implementation

`H(x)` is computed as the truncated series $\sum_{k\le\text{TRUNC}} (1/k - 1/(x+k))$ with a 4000-term default truncation; $N$ and window-width $n$ sliders control a shaded band whose left/right height difference is reported directly as the readout:

```javascript
::: js HarmonicFlattening
30, 4, 4000
armonicos1
autoPlay, allowFullscreen, openControls, h=140
:::
```

A separate labelled vertical step near the left edge illustrates the recursion $H(x+1) = H(x) + 1/(x+1)$ in the same picture.

### Technical Considerations

The extension curve is cached on a 160-point grid rather than evaluated per pixel, since each `H(x)` call is itself a 4000-term sum.

## EulerFactorialLimit

### Description

Animates Euler's infinite-product definition of the factorial, $x! = \lim_{N\to\infty} N^x \prod_{k=1}^N k/(x+k)$, sweeping the partial products up onto the Gamma curve — and, since the article's title promises $\tfrac12!$ but never computes it, defaults to $x=1/2$ so the reader watches it converge to $\sqrt\pi/2$.

### Implementation

The running log-product is accumulated incrementally, one extra factor per animation tick across a fixed sample grid, so per-tick cost stays $O(\text{samples})$ rather than $O(N \times \text{samples})$:

```javascript
::: js EulerFactorialLimit
0.5, 200, -0.9, 5, 300
factorial1
autoPlay, allowPause, autoPauseOnScroll, allowFullscreen, openControls, h=160
:::
```

A draggable `x:` slider moves the tracked evaluation point, comparing the current partial product against the exact Gamma-function value at every $N$.

### Technical Considerations

Integer factorials are marked as fixed dots on the target curve, since those are the values the partial products visibly snap onto first as $N$ grows.

## EulerMascheroniArea

### Description

Turns the Euler–Mascheroni constant $\gamma \approx 0.5772$ from an abstract residue of a limit into a visible area: the slivers between unit-width rectangles of height $1/k$ and the curve $y=1/x$, stacked into a unit square that fills to exactly $\gamma$.

### Implementation

For each $k \le N$, a rectangle of height $1/k$ is drawn over $[k,k+1]$ with the sliver above the curve shaded separately; a side panel stacks the accumulated sliver area into a unit square with a dashed line marking the $\gamma$ limit:

```javascript
::: js EulerMascheroniArea
1, 40, 200
gamma1
autoPlay, allowPause, autoPauseOnScroll, allowFullscreen, openControls, h=150
:::
```

### Technical Considerations

`sliverArea()` sums $1/k - \log((k+1)/k)$ rather than $H(N) - \log(N)$ directly, so the accumulated area matches exactly what is shaded rectangle by rectangle on screen.
