Solveeit Logo

Question

Question: For a nonnegative integer $x$, let $f(x) = |a-b|$, where $a$ is the remainder when $x$ is divided by...

For a nonnegative integer xx, let f(x)=abf(x) = |a-b|, where aa is the remainder when xx is divided by 77 and bb is the remainder when xx is divided by 143. For how many values of 1k10011 \le k \le 1001 does 0f(k)700 \le f(k) \le 70?

Answer

770

Explanation

Solution

Let

a=xmod77(0a76)a=x \mod 77 \quad (0\le a\le76), b=xmod143(0b142)b=x \mod 143 \quad (0\le b\le142)

Since 77 and 143 share the common factor 11, the system

xa(mod77)x\equiv a\pmod{77}, xb(mod143)x\equiv b\pmod{143}

has a solution if and only if

ab(mod11)a\equiv b\pmod{11}.

Write b=a+11kb=a+11k, kZk\in\mathbb{Z}.

We are given f(x)=ab=11k=11k70f(x)=|a-b|=|11k|=11|k|\le 70.

Thus k7011k6|k|\le \frac{70}{11}\quad\Longrightarrow\quad |k|\le6.

So k{6,5,4,3,2,1,0,1,2,3,4,5,6}k\in\{-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6\}.

For the solution to be valid, besides 0a760\le a \le 76, we require 0a+11k1420\le a+11k\le142.

For each fixed kk, the valid aa satisfy

a[max(0,11k),min(76,14211k)]a\in \Bigl[\max(0,-11k),\min(76,142-11k)\Bigr].

Now count the number of integers aa for each kk:

  • For k=6k=-6:

    max(0,66)=66\max(0,66)=66 and min(76,142+66=208)=76\min(76,142+66=208)=76.
    Count = 7666+1=1176-66+1=11.

  • For k=5k=-5:

    Lower bound = max(0,55)=55\max(0,55)=55; upper bound = min(76,142+55=197)=76\min(76,142+55=197)=76.
    Count = 7655+1=2276-55+1=22.

  • For k=4k=-4:

    Lower bound = 4444; upper bound = 7676.
    Count = 7644+1=3376-44+1=33.

  • For k=3k=-3:

    Lower bound = 3333; upper bound = 7676.
    Count = 7633+1=4476-33+1=44.

  • For k=2k=-2:

    Lower bound = 2222; upper bound = 7676.
    Count = 7622+1=5576-22+1=55.

  • For k=1k=-1:

    Lower bound = 1111; upper bound = 7676.
    Count = 7611+1=6676-11+1=66.

  • For k=0k=0:

    Lower bound = 00; upper bound = min(76,142)=76\min(76,142)=76.
    Count = 760+1=7776-0+1=77.

  • For k=1, 2, 3, 4, 5, 6k=1,\ 2,\ 3,\ 4,\ 5,\ 6:

    For k1k\ge1, note that 11k0-11k\le0 so lower bound = 00.
    Upper bound = 14211k142-11k. For k=1k=1 to 66, we have:

    14211131, 14222120, 14233109, 1424498, 1425587, 14266=76142-11\ge131,\ 142-22\ge120,\ 142-33\ge109,\ 142-44\ge98,\ 142-55\ge87,\ 142-66=76.

    In each case the upper bound is at least 76, so aa runs from 0 to 76.
    Count for each = 760+1=7776-0+1=77.

Now summing counts:

  • Sum for k=6k=-6 to 1-1: 11+22+33+44+55+66=231.11+22+33+44+55+66 = 231.
  • For k=0k=0: 7777.
  • For k=1k=1 to 66: 6×77=462.6\times77=462.

Total number of solutions:

231+77+462=770231+77+462=770.

Since xx runs modulo lcm(77,143)=1001\text{lcm}(77,143)=1001, every residue in {0,1,2,,1000}\{0,1,2,\ldots,1000\} is reached exactly once. Thus, there are 770 values of 1k10011\le k\le1001 for which 0f(k)700\le f(k)\le70.