---
title: "Integers Up to 1000 Coprime to 210 via PIE & Totient Periodicity"
organization: "NityaDhi Digital Mathematics Lab (Asa Edtech Private Limited)"
url: "https://www.nityadhi.com/problems/hard-olympiad-nt-w1-pie-coprime-to-210-up-to-1000"
board: "Olympiad"
grade: "Olympiad"
published_at: "2026-12-01T13:30:00+05:30"
---

# Integers Up to 1000 Coprime to 210 via PIE & Totient Periodicity

Find the number of positive integers $n \le 1000$ such that $\gcd(n, 210) = 1$.

## Textbook Solution

Since $210 = 2 \times 3 \times 5 \times 7$, an integer $n$ is coprime to $210$ if and only if $n$ is divisible by none of $2, 3, 5,$ or $7$.
Let $A_p = \{1 \le n \le 1000 : p \mid n\}$. By Inclusion-Exclusion:

1. **Universe**: $1000$.
2. **Divisible by 1 prime**:
   $$\lfloor 1000/2 \rfloor + \lfloor 1000/3 \rfloor + \lfloor 1000/5 \rfloor + \lfloor 1000/7 \rfloor = 500 + 333 + 200 + 142 = 1175.$$
3. **Divisible by 2 primes**:
   $$\lfloor 1000/6 \rfloor + \lfloor 1000/10 \rfloor + \lfloor 1000/14 \rfloor + \lfloor 1000/15 \rfloor + \lfloor 1000/21 \rfloor + \lfloor 1000/35 \rfloor$$
   $$= 166 + 100 + 71 + 66 + 47 + 28 = 478.$$
4. **Divisible by 3 primes**:
   $$\lfloor 1000/30 \rfloor + \lfloor 1000/42 \rfloor + \lfloor 1000/70 \rfloor + \lfloor 1000/105 \rfloor = 33 + 23 + 14 + 9 = 79.$$
5. **Divisible by 4 primes**:
   $$\lfloor 1000/210 \rfloor = 4.$$

Combining with alternating signs:
$$1000 - 1175 + 478 - 79 + 4 = 228.$$
Thus there are **$228$** such positive integers.

## Vedic Shortcut

Use **Totient Periodicity + Back-Counting** instead of 15 PIE terms!
- $\varphi(210) = 1 \times 2 \times 4 \times 6 = 48$ coprimes in every block of $210$.
- Since $1000 = 4 \times 210 + 160 = 5 \times 210 - 50$:
  In $[1, 1050]$ there are $5 \times 48 = 240$ coprimes to $210$.
- We only need to subtract the coprimes to $210$ in the $50$-number tail $[1001, 1050] \equiv [161, 210] \pmod{210}$ (or equivalently, $[-49, 0]$, i.e., $1 \le k \le 49$ where $k$ is coprime to $210$!).
- Wait: $210 - x$ is coprime to $210$ iff $x$ is coprime to $210$! So coprimes in $[161, 209]$ match coprimes in $[1, 49]$:
  These are $1$, primes in $[11, 49]$ ($11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47$), and products of primes $\ge 11$ up to $49$ (none, since $11^2 = 121 > 49$!).
  Count in $[1, 49]$: $1 + 11 = 12$.
Therefore: $240 - 12 =$ **$228$**!

## Common Mistakes

- **Using $\lfloor 1000 \cdot \frac{\varphi(210)}{210} \rfloor = \lfloor 228.57 \rfloor = 228$ blindly**: Although $\lfloor 228.57 \rfloor$ happens to match $228$ here, proportional scaling is NOT exact in general (e.g., for $n \le 10$, $\frac{10 \times 48}{210} = 2.28$ while there is only $1$ coprime, namely $1$!).
- **Forgetting $1$ or $11^2 = 121$ when wheel-counting**: Always remember $1$ is coprime to $210$, and composites like $11 \times 13 = 143$ must be included if the interval goes up to $160$.