Group Activities
InterviewTime limit1sMemory limit2048 MB
Given n integers up to 10^18, find their least common multiple, the smallest positive number that every given value divides evenly.
- Level
Easy3 of 10
- Topics
- Math, Number theory
- Solved
- No attempts yet
Problem
The lockdown is still in place, so the yearly group excursion cannot be organized. Instead, the study association is organizing the Fictional Programmer Convention (FPC), a digital event where programmers meet other programmers while doing various digital activities. You are on the committee that plans the FPC events. The committee will run several activities at the same time for all participants, and the participants are divided into groups. Each activity requires an exact number of participants per group. For example, a variety of digital games are played in groups of 5, a pop quiz about programming history is played in teams of 3, and a workshop on clean coding practices is held in separate sessions of 31.
The budget is limited, so you want to invite as few people as possible, but at least one person. Determine the smallest number of people you must invite so that every activity can exactly fill its groups.
Input
The first line contains one integer (), the number of activities.
Each of the next lines contains one integer (). This activity requires exactly participants per group.
Output
Print the smallest number of people such that each activity can exactly fill a number of groups. It is guaranteed that .