Skip to content
Advanced Topics · Chapter 39

Floor and Ceiling Functions

Round down, round up, keep what is left: turn floors into inequalities, split x into integer and fractional parts, and count where a line meets a staircase.

You'll need
open on YouTube
39.00%

Floor, Ceiling and Fractional Part

In this section you will be able to use ⌊x⌋, ⌈x⌉ and {x}: turn a floor into an inequality, split x into its two parts, and count crossings on a graph.

How many positive integers nn make n+100070=⌊n⌋\frac{n + 1000}{70} = \lfloor \sqrt{n} \rfloor? On one side is a straight line. On the other is a staircase. Count where they meet.

The floor ⌊x⌋\lfloor x \rfloor rounds down, the ceiling ⌈x⌉\lceil x \rceil rounds up, and {x}{‘}x{’} is what is left over. So x=⌊x⌋+{x}x = \lfloor x \rfloor + {‘}x{’}, always.

Look: a floor is an integer and an inequality at the same time. If ⌊x⌋=k\lfloor x \rfloor = k, then kk is an integer and k≤x<k+1k \le x < k + 1. Almost every problem in this chapter starts there.

When that gets messy, draw it. A floor graph is a staircase, and solutions are the places where your other curve crosses a step.

Exploreplay first, formulas later

Graph of y = ⌊x⌋; at x = 2.75: ⌊x⌋ = 2, ⌈x⌉ = 3, {x} = 0.75

−3−2−101234−4−2024x
⌊x⌋=2\lfloor x \rfloor = 2
⌈x⌉=3\lceil x \rceil = 3
{x}=0.75\{x\} = 0.75
1234{x} = 0.75⌊x⌋ = 2
⌊x⌋=2\lfloor x \rfloor = 2

Graph of y = ⌊x⌋; at x = 2.75: ⌊x⌋ = 2, ⌈x⌉ = 3, {x} = 0.75

Name it

Definition 39.0.1 · Floor, Ceiling, and Fractional Part Functions

⌊x⌋=greatest integer less than or equal to x\lfloor x \rfloor = \text{greatest integer less than or equal to } x
⌈x⌉=smallest integer greater than or equal to x\lceil x \rceil = \text{smallest integer greater than or equal to } x
{x}=fractional part of x (the value after the decimal point)\{x\} = \text{fractional part of } x \text{ (the value after the decimal point)}

For example, ⌊2.75⌋=2\lfloor 2.75 \rfloor = 2, ⌈2.75⌉=3\lceil 2.75 \rceil = 3 and {2.75}=0.75\{2.75\} = 0.75. Careful with negatives: ⌊−1.5⌋=−2\lfloor -1.5 \rfloor = -2 and {−1.5}=0.5\{-1.5\} = 0.5, because {x}=x−⌊x⌋\{x\} = x - \lfloor x \rfloor.

Concept 39.0.2 · Common Floor and Ceiling Problem Techniques

Most floor and ceiling problems can be solved using these techniques.

  1. Make the substitution x=⌊x⌋+{x}x = \lfloor x \rfloor + \{x\}.
  2. Use the floor or ceiling function to find an inequality. For example, if you know that y=⌊x⌋y = \lfloor x \rfloor, then y≤x<y+1y \le x < y + 1.
  3. Graph your equations and look for intersection points (we recommend using graph paper).

Watch itpredict, then reveal

Example 39.1

AIME

How many of the first 10001000 positive integers can be expressed in the form

⌊2x⌋+⌊4x⌋+⌊6x⌋+⌊8x⌋,\lfloor 2x \rfloor + \lfloor 4x \rfloor + \lfloor 6x \rfloor + \lfloor 8x \rfloor,

where xx is a real number, and ⌊z⌋\lfloor z \rfloor denotes the greatest integer less than or equal to zz?

Floor staircase (its total is revealed at the end of the example)

coefficient 12
coefficient 24
coefficient 36
coefficient 48
S(x)=⌊2x⌋+⌊4x⌋+⌊6x⌋+⌊8x⌋S(x) = \lfloor 2x \rfloor + \lfloor 4x \rfloor + \lfloor 6x \rfloor + \lfloor 8x \rfloor
00.20.40.60.8105101520x
x=0: 0+0+0+0=0x = 0:\ 0 + 0 + 0 + 0 = 0
Values S takes in one unit: 12 of the 20 values 0 to 19
012345678910111213141516171819
Jumped over: 3, 7, 8, 9, 13, 17, 18, 19 · S(x + 1) = S(x) + 20: the pattern repeats every 20.
Values from 1 to 1,000 that S hits: ? (hidden until the end of the example)

⌊2x⌋ + ⌊4x⌋ + ⌊6x⌋ + ⌊8x⌋

  1. 1

    Call the sum S(x)S(x). Adding 11 to xx adds 2,4,6,82, 4, 6, 8 to the four floors. So what is S(x+1)−S(x)S(x + 1) - S(x)?

    Predict first:
open on YouTube

Example 39.2

AMC 10

Let ⌊x⌋\lfloor x \rfloor denote the greatest integer less than or equal to xx. How many real numbers xx satisfy the equation x2+10,000⌊x⌋=10,000xx^2 + 10{,}000\lfloor x \rfloor = 10{,}000x?

Floor staircase (its total is revealed at the end of the example)

━ y = {x}╌ y = x²/10000
−100−5005010000.20.40.60.81x
x = 30: {x} = 0 · x²/10000 = 0.09Crossings in view: ? (hidden until the end of the example)

Graph of y = {x}, y = x²/10000

  1. 1

    Move the floor term across and use x−⌊x⌋={x}x - \lfloor x \rfloor = \{x\}. What does the equation become?

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Example 39.3

AMC 10

How many positive integers nn satisfy

n+100070=⌊n⌋?\dfrac{n + 1000}{70} = \lfloor \sqrt{n} \rfloor?

(Recall that ⌊x⌋\lfloor x \rfloor is the greatest integer not exceeding xx.)

Floor staircase (its total is revealed at the end of the example)

━ y = ⌊√n⌋╌ y = (n + 1000)/70
0500100015002000250001020304050n
n = 400: ⌊√n⌋ = 20 · (n + 1000)/70 = 20Crossings in view: ? (hidden until the end of the example)

Graph of y = ⌊√n⌋, y = (n + 1000)/70

  1. 1

    The right side is an integer. So n+100070\frac{n + 1000}{70} is an integer kk. Write nn in terms of kk.

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Try it

Problem 39.1.1

AMC 10

How many distinct values of xx satisfy ⌊x⌋2−3x+2=0\lfloor x \rfloor^2 - 3x + 2 = 0, where ⌊x⌋\lfloor x \rfloor denotes the largest integer less than or equal to xx?

Staircase y = ⌊x⌋² and y = 3x − 2 for −2 ≤ x ≤ 5: 4 crossings

━ y = ⌊x⌋²╌ y = 3x − 2
−2−1012345−10−50510152025x
x = 1.5: ⌊x⌋² = 1 · 3x − 2 = 2.5

Graph of y = ⌊x⌋², y = 3x − 2

Problem 39.1.2(additional)

AMC 10

The graph of

f(x)=∣⌊x⌋∣−∣⌊1−x⌋∣f(x) = |\lfloor x \rfloor| - |\lfloor 1 - x \rfloor|

is symmetric about which of the following? (Here ⌊x⌋\lfloor x \rfloor is the greatest integer not exceeding xx.)

Click a choice or type its letter (A–E).

Problem 39.1.4(additional)

AMC 10

Cozy the Cat and Dash the Dog are going up a staircase with a certain number of steps. However, instead of walking up the steps one at a time, both Cozy and Dash jump. Cozy goes two steps up with each jump (though if necessary, he will just jump the last step). Dash goes five steps up with each jump (though if necessary, he will just jump the last steps if there are fewer than 55 steps left). Suppose Dash takes 1919 fewer jumps than Cozy to reach the top of the staircase. Let ss denote the sum of all possible numbers of steps this staircase can have. What is the sum of the digits of ss?

Contest cornerreal contest problems

Problem 39.1.3(additional)

AMC 10

This problem also appears in the book as 22.1.13.

For how many positive integers n≤1000n \le 1000 is

⌊998n⌋+⌊999n⌋+⌊1000n⌋\left\lfloor \frac{998}{n} \right\rfloor + \left\lfloor \frac{999}{n} \right\rfloor + \left\lfloor \frac{1000}{n} \right\rfloor

not divisible by 33? (Recall that ⌊x⌋\lfloor x \rfloor is the greatest integer less than or equal to xx.)

Problem 39.1.5(additional)

AIME

Suppose rr is a real number for which

⌊r+19100⌋+⌊r+20100⌋+⌊r+21100⌋+⋯+⌊r+91100⌋=546.\left\lfloor r + \frac{19}{100} \right\rfloor + \left\lfloor r + \frac{20}{100} \right\rfloor + \left\lfloor r + \frac{21}{100} \right\rfloor + \cdots + \left\lfloor r + \frac{91}{100} \right\rfloor = 546.

Find ⌊100r⌋\lfloor 100r \rfloor. (For real xx, ⌊x⌋\lfloor x \rfloor is the greatest integer less than or equal to xx.)

Problem 39.1.6(additional)

AIME

How many positive integers NN less than 10001000 are there such that the equation x⌊x⌋=Nx^{\lfloor x \rfloor} = N has a solution for xx?

Problem 39.1.7(additional)

AIME

Given a nonnegative real number xx, let ⟨x⟩\langle x \rangle denote the fractional part of xx; that is, ⟨x⟩=x−⌊x⌋\langle x \rangle = x - \lfloor x \rfloor, where ⌊x⌋\lfloor x \rfloor denotes the greatest integer less than or equal to xx. Suppose that aa is positive, ⟨a−1⟩=⟨a2⟩\langle a^{-1} \rangle = \langle a^2 \rangle, and 2<a2<32 < a^2 < 3. Find the value of a12−144a−1a^{12} - 144a^{-1}.

Problem 39.1.9(additional)

AIME

Find the least positive integer kk for which the equation ⌊2002n⌋=k\left\lfloor \dfrac{2002}{n} \right\rfloor = k has no integer solutions for nn. (The notation ⌊x⌋\lfloor x \rfloor means the greatest integer less than or equal to xx.)

Problem 39.1.10(additional)

AIME

Find the number of positive integers nn less than 10001000 for which there exists a positive real number xx such that n=x⌊x⌋n = x\lfloor x \rfloor. Note: ⌊x⌋\lfloor x \rfloor is the greatest integer less than or equal to xx.

Problem 39.1.13(additional)

AIME

For a real number aa, let ⌊a⌋\lfloor a \rfloor denote the greatest integer less than or equal to aa. Let R\mathcal{R} denote the region in the coordinate plane consisting of points (x,y)(x, y) such that ⌊x⌋2+⌊y⌋2=25\lfloor x \rfloor^2 + \lfloor y \rfloor^2 = 25. The region R\mathcal{R} is completely contained in a disk of radius rr (a disk is the union of a circle and its interior). The minimum value of rr can be written as mn\frac{\sqrt{m}}{n}, where mm and nn are integers and mm is not divisible by the square of any prime. Find m+nm + n.

Checkpoint for section 39.0

Get 2 of 3 right to master this section. One try each, no hints.
1

Find ⌊−2.3⌋+⌈−2.3⌉\lfloor -2.3 \rfloor + \lceil -2.3 \rceil.

2

Solve x+⌊x⌋=8.4x + \lfloor x \rfloor = 8.4 for xx.

3

How many positive integers nn satisfy ⌊n⌋=5\lfloor \sqrt{n} \rfloor = 5?

39.1

Practice Problems

In this section you will be able to mix floors with averages, cube roots and counting arguments.

These last four hide a floor inside something else: a mean and a mode, a cube root, a familiar staircase, and three floors that together pin down a number. Every problem has three hints if you get stuck.

Want every problem from this chapter on one page? Open the problem set.

Contest cornerreal contest problems

Problem 39.1.8(additional)

AIME

This problem also appears in the book as 18.1.14.

A sample of 121121 integers is given, each between 11 and 10001000 inclusive, with repetitions allowed. The sample has a unique mode (most frequent value). Let DD be the difference between the mode and the arithmetic mean of the sample. What is the largest possible value of ⌊D⌋\lfloor D \rfloor? (For real xx, ⌊x⌋\lfloor x \rfloor is the greatest integer less than or equal to xx.)

Problem 39.1.11(additional)

AIME

Given a real number xx, let ⌊x⌋\lfloor x \rfloor denote the greatest integer less than or equal to xx. For a certain integer kk, there are exactly 7070 positive integers n1,n2,…,n70n_1, n_2, \ldots, n_{70} such that

k=⌊n13⌋=⌊n23⌋=⋯=⌊n703⌋k = \lfloor \sqrt[3]{n_1} \rfloor = \lfloor \sqrt[3]{n_2} \rfloor = \cdots = \lfloor \sqrt[3]{n_{70}} \rfloor

and kk divides nin_i for all ii such that 1≤i≤701 \le i \le 70. Find the maximum value of nik\dfrac{n_i}{k} for 1≤i≤701 \le i \le 70.

Problem 39.1.12(additional)

AMC 12

This problem also appears in the book as 39.3.

How many positive integers nn satisfy

n+100070=⌊n⌋?\dfrac{n + 1000}{70} = \lfloor \sqrt{n} \rfloor?

(Recall that ⌊x⌋\lfloor x \rfloor is the greatest integer not exceeding xx.)

Problem 39.1.14(additional)

AIMEChallenge

Find the number of positive integers n≤600n \le 600 whose value can be uniquely determined when the values of ⌊n4⌋\left\lfloor \frac{n}{4} \right\rfloor, ⌊n5⌋\left\lfloor \frac{n}{5} \right\rfloor, and ⌊n6⌋\left\lfloor \frac{n}{6} \right\rfloor are given, where ⌊x⌋\lfloor x \rfloor denotes the greatest integer less than or equal to the real number xx.