Puzzle Spree

Puzzle Spree

Share this post

Puzzle Spree
Puzzle Spree
Peculiar Numbers

Peculiar Numbers

Kuai Yu's avatar
Kuai Yu
Dec 20, 2024
∙ Paid
2

Share this post

Puzzle Spree
Puzzle Spree
Peculiar Numbers
2
Share

We define a number N as peculiar if it is divisible by the integer part of its square root. Formally, N is peculiar if:

\(N \bmod \lfloor \sqrt{N}\rfloor = 0\)

Given a range [L, R], implement a function to determine how many integers within this range (inclusive) are peculiar.

Examples

Example 1

Input: L=1, R=10

Output: 7

Explanation: The peculiar numbers between 1 and 10 are 1,2,3,4,6,8,9.

Exampl…

Keep reading with a 7-day free trial

Subscribe to Puzzle Spree to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Puzzle Spree
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share