---
title: "Smallest Positive Integer x Making 270+x a Square and 270-x a Cube"
organization: "NityaDhi Digital Mathematics Lab (Asa Edtech Private Limited)"
url: "https://www.nityadhi.com/problems/hard-c8-w1-sqcb-simultaneous-square-and-cube"
board: "CBSE"
grade: "Class 8"
published_at: "2026-12-01T12:00:00+05:30"
---

# Smallest Positive Integer x Making 270+x a Square and 270-x a Cube

Find the smallest positive integer $x$ such that $270 + x$ is a perfect square and $270 - x$ is a positive perfect cube.

## Textbook Solution

**Step 1: List all positive perfect cubes less than $270$.**
Since $x > 0$ and $270 - x$ is a positive perfect cube, $1 \le 270 - x < 270$.
The only perfect cubes in this range are:
$$6^3 = 216, \quad 5^3 = 125, \quad 4^3 = 64, \quad 3^3 = 27, \quad 2^3 = 8, \quad 1^3 = 1$$

**Step 2: Test the corresponding values of $x$ in increasing order.**
The smallest $x$ corresponds to the largest cube ($216$):
$$270 - x = 216 \implies x = 54$$

**Step 3: Check whether $270 + x$ is a perfect square.**
$$270 + 54 = 324 = 18^2$$
Since $324$ is a perfect square, $x = 54$ satisfies both conditions, and no smaller positive integer can make $270 - x$ a perfect cube.

*(Note: Checking the remaining candidates $x = 145, 206, 243, 262, 269$ gives $270+x = 415, 476, 513, 532, 539$, none of which is a square, so $x=54$ is in fact the unique solution.)*

## Vedic Shortcut

**Cube-First Filtering:**
Cubes are far sparser than squares! Between $1$ and $270$, there are $16$ squares but only $6$ cubes.
Always filter by the sparser set (cubes) from top down: $270 - 216 = 54$, and $270 + 54 = 324 = 18^2$ succeeds on the very first check!

## Common Mistakes

- **Filtering by squares first:** Checking $270 + x = 289, 324, 361, \dots$ works too, but checking cubes is 3 times faster and guarantees minimality immediately.