Mathematics
Mathematics, 24.11.2021 04:10, yasarhan2

Babylonians use regular numbers to keep time. A regular number in math is defined to be a number that is a factor of some power of 60 (60, 3600, etc). Equivalently we can say that a regular number is one whose ONLY prime divisors are 2, 3 and 5. The first 10 regular numbers are: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12. Your task is to compute the n-th regular number. Hint as a possible algorithm: 1. Use a priority queue.
2. The regular numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, ...
Note that other than 1, each number in the sequence can be generated by some previous number in the sequence by multiplying that previous number by a 2, 3, or 5. So you start with offering a 1 to the priority queue, then you poll the priority queue. Now with this 1 retrieved (which is the 1st regular number), you generate a few regular numbers and offer them back to the priority queue. Repeat the process and retrieve the numbers. The n-th number retrieved is the answer. Grading metric: some effort 2 points significant effort 5 points Each solved case is additional 1 point (there are 5 test cases). Write to the console the answer of these 5 test cases 1. the 10th regular number 2. the 50th regular number 3. the 100th regular number 4. the 200th regular number 5. the 300th regular number.

answer
Answers: 3

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 15:00, nkh69
Given: x + y = 6. if xe (-15, -6, -1), then which of the following sets of ordered pairs are solutions? Β© {(-15, -21), (-6, -12), (-1, -7)} [(-15, 21), (-6, , 7)} {(-15, 21), (-6, 12), (-1, -7)}
Answers: 2
image
Mathematics, 22.06.2019 00:00, sydneydavis57
Technicians have installed a center pivot, circular irrigator for a farm that covers 25 acres. a.) how long is the irrigation boom (in feet) from the center pivot to its farthest extent? b.) if the irrigation boom makes 4 full revolutions in a day, how many miles does the end of the boom travel in 5 days?
Answers: 1
image
Mathematics, 22.06.2019 01:00, jasminebrown72
Mia’s gross pay is 2953 her deductions total 724.15 what percent if her gross pay is take-home pay
Answers: 1
image
Mathematics, 22.06.2019 01:40, jraemier5480
Afamily has two cars. the first car has a fuel efficiency of 25 miles per gallon of gas and the second has a fuel efficiency of 15 miles per gallon of gas. during one particular week, the two cars went a combined total of 1025 miles, for a total gas consumption of 55 gallons. how many gallons were consumed by each of the two cars that week?
Answers: 1
Do you know the correct answer?
Babylonians use regular numbers to keep time. A regular number in math is defined to be a number tha...

Questions in other subjects:

Konu
Mathematics, 06.05.2020 19:17