Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
stringlengths
6
6
category
stringclasses
6 values
prompt
stringlengths
96
245
api_description
stringclasses
1 value
expected_output
stringlengths
19
97
cm-000
recurrences
The recurrence T(0) = 0, T(n) = 2*T(n-1) + 1 counts the moves to solve the Tower of Hanoi. Give T(10), T(20) and T(64). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[1023, 1048575, 18446744073709551615]]}
cm-001
recurrences
The recurrence L(0) = 1, L(n) = L(n-1) + n counts the regions n straight lines cut the plane into. Give L(5), L(50) and L(1000). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[16, 1276, 500501]]}
cm-002
recurrences
Bent lines: Z(0) = 1, Z(n) = Z(n-1) + 4*n - 3 counts the regions n V-shaped bent lines cut the plane into. Give Z(4), Z(30) and Z(500). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[29, 1771, 499501]]}
cm-003
recurrences
In the Josephus problem, n people stand in a circle and every SECOND person is eliminated, starting by eliminating person 2. Give the 1-indexed position of the survivor for n = 10, n = 100 and n = 1000. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[5, 73, 977]]}
cm-004
recurrences
The recurrence f(0) = 1, f(1) = 1, f(n) = f(n-1) + f(n-2) is the Fibonacci sequence. Give f(30), f(60) and the number of DECIMAL DIGITS of f(1000). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[1346269, 2504730781961, 209]]}
cm-005
recurrences
A recurrence a(0) = 2, a(n) = 3*a(n-1) - 1. Give a(5), a(15) and a(40). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[365, 21523361, 18236498188585393202]]}
cm-006
recurrences
The number of ways to tile a 2-by-n strip with 1-by-2 dominoes satisfies D(0) = 1, D(1) = 1, D(n) = D(n-1) + D(n-2). Give D(12), D(25) and the smallest n for which D(n) exceeds one million. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[233, 121393, 30]]}
cm-007
sums
Compute the sum of k**3 for k = 1 to n, for n = 10, n = 100 and n = 1000. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[3025, 25502500, 250500250000]]}
cm-008
sums
Compute the sum of k * 2**k for k = 0 to n, for n = 10, n = 20 and n = 50. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[18434, 39845890, 110338190870577154]]}
cm-009
sums
The harmonic number H_n is the sum of 1/k for k = 1 to n, computed EXACTLY as a rational. Give H_10, H_20 and H_50, each as [numerator, denominator] in lowest terms. Return three rows, in that order.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[7381, 2520], [55835135, 15519504], [13943237577224054960759, 3099044504245996706400]]}
cm-010
sums
Compute the telescoping sum of 1/(k*(k+1)) for k = 1 to n exactly, for n = 10, n = 100 and n = 1000. Give each as [numerator, denominator]. Return three rows.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[10, 11], [100, 101], [1000, 1001]]}
cm-011
sums
Compute the alternating sum of (-1)**(k+1) * k for k = 1 to n, for n = 9, n = 10 and n = 101. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[5, -5, 51]]}
cm-012
sums
Compute the sum of 1/(k**2) for k = 1 to n EXACTLY as a rational, for n = 6 and n = 12, and give the numerator of the n = 6 value alone as a third answer. Return three rows: [num, den] for n=6, [num, den] for n=12, and [numerator] again for n=6.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[5369, 3600], [240505109, 153679680], [5369]]}
cm-013
sums
Compute the sum of k * (k + 1) for k = 1 to n, for n = 10, n = 100 and n = 5000. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[440, 343400, 41691670000]]}
cm-014
integer-functions
Compute the sum of floor(sqrt(k)) for k = 1 to n, for n = 100, n = 1000 and n = 10000. Use exact integer square roots, not floating point. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[625, 20615, 661750]]}
cm-015
integer-functions
Compute the sum of floor(n / k) for k = 1 to n, for n = 20, n = 200 and n = 2000. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[66, 1098, 15518]]}
cm-016
integer-functions
For x = 17/5 as an exact rational, give floor(x), ceil(x), floor(-x) and ceil(-x). Return one row of the four integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[3, 4, -4, -3]]}
cm-017
integer-functions
Count the decimal digits of 2**n for n = 10, n = 100 and n = 1000, computing the powers exactly rather than with logarithms. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[4, 31, 302]]}
cm-018
integer-functions
How many integers k in 1..n satisfy floor(n/k) == 1? Give the count for n = 10, n = 100 and n = 1000. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[5, 50, 500]]}
cm-019
integer-functions
The Spectrum of 3/2 is the sequence floor(k * 3/2) for k = 1, 2, 3, .... Give its first eight terms, computed with exact rationals. Return one row of the eight integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[1, 3, 4, 6, 7, 9, 10, 12]]}
cm-020
binomials
Give C(20, 10), C(52, 5) and C(100, 50) as exact integers. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[184756, 2598960, 100891344545564193334812497256]]}
cm-021
binomials
Compute the sum of C(n, k)**2 for k = 0 to n, for n = 5, n = 10 and n = 20. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[252, 184756, 137846528820]]}
cm-022
binomials
The hockey-stick identity sums C(k, r) for k = r to n. Compute it for (r, n) = (3, 10), (5, 20) and (2, 100). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[330, 54264, 166650]]}
cm-023
binomials
Compute the alternating sum of (-1)**k * C(n, k) for k = 0 to n, for n = 0, n = 1 and n = 7. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[1, 0, 0]]}
cm-024
binomials
Vandermonde's convolution sums C(m, k) * C(n, r - k) over k. Compute it for (m, n, r) = (5, 7, 4), (10, 10, 10) and (8, 3, 5). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[495, 184756, 462]]}
cm-025
binomials
Give the Catalan numbers C(2n, n) // (n + 1) for n = 5, n = 10 and n = 20. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[42, 16796, 6564120420]]}
cm-026
special-numbers
The Stirling numbers of the SECOND kind S(n, k) count partitions of n labelled items into k non-empty blocks, with S(0,0)=1 and S(n,k) = k*S(n-1,k) + S(n-1,k-1). Give S(6,3), S(10,5) and S(12,4). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[90, 42525, 611501]]}
cm-027
special-numbers
The Bell number B(n) is the total number of partitions of n labelled items, the sum of S(n, k) over all k. Give B(5), B(8) and B(12). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[52, 4140, 4213597]]}
cm-028
special-numbers
The unsigned Stirling numbers of the FIRST kind c(n, k) count permutations of n items with k cycles, with c(0,0)=1 and c(n,k) = (n-1)*c(n-1,k) + c(n-1,k-1). Give c(5,2), c(8,3) and c(10,4). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[50, 13132, 723680]]}
cm-029
special-numbers
The Eulerian number A(n, k) counts permutations of n items with exactly k ascents, with A(n,k) = (k+1)*A(n-1,k) + (n-k)*A(n-1,k-1) and A(0,0)=1. Give A(5,2), A(7,3) and A(8,4). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[66, 2416, 15619]]}
cm-030
special-numbers
Give the exact rational value of the harmonic-like sum of 1/(2k-1) for k = 1 to n, for n = 5 and n = 12, each as [numerator, denominator]. Return two rows.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[563, 315], [744355888, 334639305]]}
cm-031
special-numbers
The double factorial n!! multiplies every other integer down from n. Give 10!!, 11!! and 15!! as exact integers. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[3840, 10395, 2027025]]}
cm-032
number-theory
Give gcd(1071, 462), and the NUMBER of division steps Euclid's algorithm takes on that pair, counting each replacement of (a, b) by (b, a mod b) as one step until b becomes 0. Return one row [gcd, steps].
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[21, 3]]}
cm-033
number-theory
Euler's totient phi(n) counts the integers in 1..n coprime to n. Give phi(36), phi(97) and phi(1000). Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[12, 96, 400]]}
cm-034
number-theory
Fibonacci numbers satisfy gcd(F(m), F(n)) = F(gcd(m, n)) with F(1)=F(2)=1. Give gcd(F(12), F(18)), gcd(F(15), F(25)) and gcd(F(20), F(30)) as exact integers. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[8, 5, 55]]}
cm-035
number-theory
Give the exponent of the prime 2 and of the prime 5 in the factorisation of 100!, and the number of trailing zeros of 100! in decimal. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[97, 24, 24]]}
cm-036
number-theory
Give the number of primes below 100, below 1000 and below 10000, counted with a sieve. Return one row of the three integers.
You are solving discrete-mathematics problems EXACTLY, by computing them in Python rather than recalling a formula's value. Available imports: math, fractions (Fraction), itertools. Nothing else is needed. ANSWERS MUST BE EXACT. There are no floats in this environment: * an integer answer is a plain Python int (the...
{"rows": [[25, 168, 1229]]}

concretemath-tasks-v1

37 exact discrete-mathematics tasks for the concretemath-env RL environment, on the topics of Concrete Mathematics (Graham, Knuth & Patashnik): recurrences, sums, integer functions, binomial coefficients, special numbers and elementary number theory.

field meaning
task_id cm-000cm-036
category recurrences / sums / integer-functions / binomials / special-numbers / number-theory
prompt the question and the exact shape of the answer
api_description the shared preamble (exact-arithmetic rules, the [num, den] convention)
expected_output JSON {"rows": [...]}, computed by executing a reference solution

Categories: recurrences 7, sums 7, integer-functions 6, binomials 6, special-numbers 6, number-theory 5. No dependencies — math, fractions and itertools are all standard library.

Original problems, not the book's exercises

Nothing is copied. Every task is written fresh on the topics the book teaches — a copyright decision and the stronger evaluation one, since the book's exercises and their answers are all over the public web and can be recalled rather than derived.

Not a single float

Integers stay integers (Python's are unbounded) and rationals are returned as [numerator, denominator] in lowest terms. That is the subject rather than a style rule: H_10 is 7381/2520, not 2.9289682539682538. sum(1/k ...) is a wrong answer to a harmonic-number question and sum(Fraction(1, k) ...) is a right one, so the grader is built to tell those apart — a float never passes for an integer, even when equal in value.

Answer keys are executed, and cross-checked against a second method

Where a closed form exists, the task computes the answer by ITERATION and asserts the closed form agrees — so the key is never just "whatever the first implementation printed". Those assertions are inside the builder, so the dataset fails to build if the two ever disagree.

That earned its keep immediately: the closed form written for a(n) = 3·a(n-1) - 1 was (3^n + 1)/2, which is the answer to a different recurrence. The iteration was right and the check was wrong — exactly the failure a cross-check exists to catch, and it would otherwise have shipped as a wrong answer key.

Verify with python environments/concretemath_env/build_tasks.py --verify (37/37). Source: https://github.com/eltociear/my-molt-agent/tree/main/environments/concretemath_env

Downloads last month
27