Harmonic series calculator
Pick a whole number n and get the harmonic series added up to 1/n: the first 10 terms come to 2.928968253968. The total keeps growing without limit, but slowly, roughly like the natural logarithm of n. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 10
- Sum
- 2.928968254
The harmonic series is the infinite sum of reciprocals of the positive integers: one plus one half plus one third and so on. Its partial sums H_n grow without bound, yet they grow slowly—roughly like the natural logarithm of n plus a constant. No spreadsheet loops, no copy-paste rounding surprises, and the same pure logic runs free in your browser.
What the harmonic partial sum actually is
The n-th harmonic number is defined as H_n equals the sum from k equals one to n of one over k. For n equals one the sum is simply one. For n equals two it is one plus one half, which is one point five.
For n equals three you add one third and obtain approximately one point eight three three. Teachers use these early values to show that the series diverges even though successive terms shrink toward zero: each new reciprocal is smaller, yet the running total still creeps upward forever. Analysts meet the same partial sums when they bound comparison tests, estimate the cost of nested loops that visit one plus two plus three items, or approximate the coupon-collector expectation.
Because the true infinite series diverges, software never returns a final total for the whole series; it always returns a finite partial sum indexed by n. The response reports the integer n you asked for, a stably rounded sum so repeated calls match byte for byte, and a short formula string that restates H_n in human-readable form for logs and lesson materials.
Where harmonic numbers come in handy
Classrooms use a harmonic series calculator to let students explore growth rates without writing their first for-loop under time pressure. Coding-interview prep uses H_n to discuss big-O intuition: the sum of one over k is Theta of log n, which explains why some nested algorithms feel almost linear yet still outgrow constant factors. Product and finance teams sometimes embed harmonic partial sums when they model diminishing returns, staged rollouts, or the expected number of trials until coverage in simple coupon-style experiments.
Failed validation does not consume balance.
What you can do with it
Classroom harmonic-number demos
Let students request H_n for increasing n and observe slow logarithmic growth without writing the summation loop themselves.
Algorithm complexity illustrations
Show that summing one over k tracks log n when explaining nested loops, coupon collector sketches, or harmonic bounds in analysis notes.
FAQ
What happens if n is below 1?
Harmonic numbers are defined for positive integers only, so zero and negative values are rejected without charge.
How accurate is the returned sum?
Reciprocals are added in a stable order and the result is rounded to twelve decimal places for cross-runtime reproducibility. It is not an exact rational fraction.
Is there a maximum n?
Yes. n must be at most one million so edge runtime stays bounded.
Why does the harmonic series diverge if its terms keep shrinking?
Each new term is smaller, but the running total still creeps upward forever, roughly like the natural logarithm of n plus a constant. That is why you always get a partial sum for a chosen n, never a total for the whole series.
Can I get the sum as an exact fraction?
No. The result is a decimal value, rounded so it stays the same every time, such as 2.928968253968 for the first 10 terms. If a proof needs the exact reduced fraction, it has to be worked out separately.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/harmonic-series \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":10}'const res = await fetch("https://api.kit.forhosting.com/math/harmonic-series", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/harmonic-series",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/harmonic-series", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/harmonic-series", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.harmonic_series",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This harmonic series calculator turns that classic definition into a single deterministic API call: send a positive integer n and receive the exact floating-point value of the n-th partial sum, together with a clear formula label so students, engineers, and data pipelines can verify the request without re-deriving the series.
What the harmonic partial sum actually is
This endpoint implements that mathematical object directly: a pure loop of reciprocal additions with a fixed upper bound on n so memory and runtime stay predictable on the edge.
Input contract, rounding and error behaviour
On success the body contains n, sum, and formula. If you need symbolic exact fractions such as a reduced numerator over denominator, this capability is not a computer-algebra system; it returns a floating-point partial sum only. POST a JSON body with a single required field n: an integer greater than or equal to one and at most one million. Values below one, non-integers, missing fields, and n above the published maximum fail with invalid_input and are not billed, which keeps bad requests out of your usage meter. Twelve digits is more than enough for classroom checks and most engineering estimates while remaining a clean JSON number. Pair it with your own exact rational code when proofs require fractions, and use this API when you need a fast, auditable numeric H_n in pipelines, worksheets, or interview demos.
Where a harmonic series API earns its keep
Bound n, keep the request small, and you get a reproducible number you can pin in tests, notebooks, and edge workers without standing up a math library of your own.
Integration use cases
Deterministic fixtures in data pipelines
Pin H_n in integration tests or notebooks when a model or simulation needs a stable harmonic partial sum as a reference constant.
Technical questions
What is the n-th partial sum of the harmonic series?
It is H_n = 1 + 1/2 + … + 1/n. This API returns that floating-point sum for a positive integer n you supply.
What does the harmonic series calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.