TopCoder problem "OneTwoThree" used in TCHS08 Round 3 (Division I Level Two)



Problem Statement

    Find the smallest number that is divisible by all the integers between 1 and n, inclusive, and return it modulo 987654321.
 

Definition

    
Class:OneTwoThree
Method:minimalNumber
Parameters:int
Returns:int
Method signature:int minimalNumber(int n)
(be sure your method is public)
    
 

Constraints

-n will be between 1 and 100000, inclusive.
 

Examples

0)
    
1
Returns: 1
1)
    
3
Returns: 6
The smallest number divisible by 1, 2 and 3 is just 1 * 2 * 3.
2)
    
10
Returns: 2520
3)
    
1234
Returns: 411860547
4)
    
97969
Returns: 528039414

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=8445

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=11150&pm=8445

Writer:

mateuszek

Testers:

PabloGilberto , Olexiy , lovro , ivan_metelsky

Problem categories:

Brute Force, Math, Simple Search, Iteration