Ominsik Number
Time limit2sMemory limit128 MB
Given N up to one million, compute the least common multiple of all integers from 1 to N modulo 987654321.
- Level
Medium5 of 10
- Topics
- Number theory, Math, Implementation
- Solved
- No attempts yet
Problem
You are given a positive integer N. Find the smallest positive integer that is divisible by every integer from 1 through N.
Because this value can be very large, output only its remainder when divided by 987654321.
Input
The first line contains a positive integer N. N is between 1 and 1,000,000 inclusive.
Output
Print the remainder when the smallest positive integer divisible by every integer from 1 through N is divided by 987654321.