Exact Dedekind Sum
Compute s(h,k)=Σ(r=1…k−1)((r/k))((hr/k)) as a reduced fraction and finite value, using the zero-at-integers sawtooth convention and k≤10,000.
Description
A Dedekind sum combines two periodic sawtooth functions.
A Dedekind sum combines two periodic sawtooth functions. The convention that the sawtooth is zero at integers changes which summands contribute.1
The tool returns numerator, denominator, value. The indexing and output conventions below determine how to read these values.
When to use Exact Dedekind Sum
Use this for the following task: Compute s(h,k)=Σ(r=1…k−1)((r/k))((hr/k)) as a reduced fraction and finite value, using the zero-at-integers sawtooth convention and k≤10,000. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Exact Dedekind Sum and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter h, k according to the field table, then run the tool.
- Read numerator, denominator, value. Preserve exact decimal strings and the stated indexing or coefficient order.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| h | Signed integer multiplier | string (integer/arbitrary); maximum text length 200; pattern ^-?(0|[1-9][0-9]*)$ | Required |
| k | Positive denominator (summation resource limit 10000) | integer; minimum 1; maximum 10000 | Required |
Normalize signed h modulo positive k, sum scaled BigInt numerators for nonzero residues and reduce the fraction by gcd. Return exact strings and a floating quotient.
s(h,k)=Σ[r=1..k−1]((r/k))((h×r/k)); ((x))=fractionalPart(x)−1/2 unless x is integral The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| numerator | Reduced Dedekind sum numerator | string (integer/arbitrary) |
| denominator | Reduced Dedekind sum denominator | string (integer/arbitrary) |
| value | Dedekind sum value | number |
{
"input": {
"h": "1",
"k": 5
},
"output": {
"numerator": "1",
"denominator": "5",
"value": 0.2
}
} Limitations and assumptions
The denominator k is at most 10000 and need not be coprime with h. The floating value is approximate; the reduced fraction preserves the chosen convention.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Jacobi Symbol when you need its operation: Return (a/n) for a signed decimal numerator and positive odd decimal denominator, including (a/1)=1; a value of one does not prove a quadratic residue for composite n. Choose Modular Inverse for the complementary operation: Find the least nonnegative inverse of a signed decimal integer modulo a decimal modulus of at least two, rejecting noncoprime pairs.
Background reference: Arithmetic functions: dedekind sum.
References
-
Arithmetic functions: dedekind sum — SageMath developers
Similar or alternative tools
- Jacobi Symbol
Return (a/n) for a signed decimal numerator and positive odd decimal denominator, including (a/1)=1; a value of one does not prove a quadratic residue for composite n.
- Modular Inverse
Find the least nonnegative inverse of a signed decimal integer modulo a decimal modulus of at least two, rejecting noncoprime pairs.