Concept explainers
Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this
- 1. Let y be the year (such as 1800 or 2001).
- 2. Divide y by 19 and call the remainder a. Ignore the quotient.
- 3. Divide y by 100 to get a quotient b and a remainder c.
- 4. Divide b by 4 to get a quotient d and a remainder e.
- 5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder.
- 6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient.
- 7. Divide c by 4 to get a quotient j and a remainder k.
- 8. Divide a + 11 * h by 319 to get a quotient m. Ignore the remainder.
- 9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r. Ignore the quotient.
- 10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder.
- 11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.
Then Easter falls on day p of month n. For example, if y is 2001:
a = 6
b = 20, c = 1
d = 5, e = 0
g = 6
h = 18
j = 0, k = 1
m = 0
r = 6
n = 4
p = 15
Therefore, in 2001, Easter Sunday fell on April 15. Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
C++ How to Program (10th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Introduction to Programming Using Visual Basic (10th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Pythonarrow_forwarduse pythonarrow_forwardGiven a positive integer 'n', find and return the minimum number of steps that 'n' has to take to get reduced to 1. You can perform any one of the following 3 steps:1.) Subtract 1 from it. (n = n - 1) ,2.) If its divisible by 2, divide by 2.( if n % 2 == 0, then n = n / 2 ) ,3.) If its divisible by 3, divide by 3. (if n % 3 == 0, then n = n / 3 ). Write brute-force recursive solution for this.Input format :The first and the only line of input contains an integer value, 'n'.Output format :Print the minimum number of steps.Constraints :1 <= n <= 200 Time Limit: 1 secSample Input 1 :4Sample Output 1 :2 Explanation of Sample Output 1 :For n = 4Step 1 : n = 4 / 2 = 2Step 2 : n = 2 / 2 = 1 Sample Input 2 :7Sample Output 2 :3Explanation of Sample Output 2 :For n = 7Step 1 : n = 7 - 1 = 6Step 2 : n = 6 / 3 = 2 Step 3 : n = 2 / 2 = 1 SolutionDp///.arrow_forward
- Correct answer will be upvoted else downvoted. Computer science. You have two positive integers an and b. You can perform two sorts of tasks: a=⌊ab⌋ (supplant a with the integer part of the division among an and b) b=b+1 (increment b by 1) Track down the base number of activities needed to make a=0. Input The primary line contains a solitary integer t (1≤t≤100) — the number of experiments. The main line of the depiction of each experiment contains two integers a, b (1≤a,b≤109). Output For each experiment, print a solitary integer: the base number of activities needed to make a=0.arrow_forwarduse JAVA to write the code. : Euclid’s algorithm for finding the greatest common divisor (gdc) of two numbers The algorithm: given two numbers, n1 and n2: Divide n1 by n2 and let r be the remainder. If the remainder r is 0, the algorithm is finished and the answer is n2. (If the remainder is 1, the numbers are mutually prime and we are done-see below.) Set n1 to the value of n2, set n2 to the value of r, and go back to step 1. Entering 0 for one of the values is bad. It should work for the other value, but you have to figure out which is OK and which is bad. Catch this problem as it happens and make the user enter another value until they enter an acceptable one. Give an appropriate error message if this happens.arrow_forwardFibonacci numbers have a lot of numerical properties. A few can be mentioned is that the squares of the Fibonacci numbers added together by the consecutive number you get the next Fibonacci number, and when you add the squares together it also results to the Fibonacci sequence. Another is when adding the squares of the Fibonacci numbers for example one plus one plus four is six. Add nine to that, we get 15. Add 25, we get 40. Add 64, we get 104. Fibonacci shows here. Six is two times three, 15 is three times five and so on. Last to be mentioned is when you divide 13 by eight, you get 1.625 and if you dividde this larger number by the smaller number, the ratios get closer and closer to about 1.618. Now the question is, what other numerical properties can you identify in the Fibonacci sequence ASIDE from those mentioned above and verify your assumptions.arrow_forward
- Correct answer will be upvoted else downvoted. Computer science. After painting the white cells of the board, you want to place the maximum number of dominoes on it, according to the following rules: each domino covers two adjacent cells; each cell is covered by at most one domino; if a domino is placed horizontally (it covers two adjacent cells in one of the rows), it should cover only red cells; if a domino is placed vertically (it covers two adjacent cells in one of the columns), it should cover only blue cells. Let the value of the board be the maximum number of dominoes you can place. Calculate the sum of values of the board over all 2w possible ways to paint it. Since it can be huge, print it modulo 998244353. Input The first line contains two integers n and m (1≤n,m≤3⋅105; nm≤3⋅105) — the number of rows and columns, respectively. Then n lines follow, each line contains a string of m characters. The j-th character in the i-th string is * if the j-th cell in the i-th row…arrow_forwardDecimal points are sometimes used in hotel room numbers . If you were assigned to room 6.10 , where would you expect to find it.arrow_forwardLeap Year: The earth doesn't take exactly 365 days to revolve around the sun and because of this we have leap years roughly every 4 years to make up the difference. The exact rule is: • Years divisible by 4 are leap years • except if they are also divisible by 100 and then they are not leap years (so 1900 was not a leap year), • unless they are also divisible by 400 and then they ARE leap years (so 2000 was a leap year). Part 1) Write a function in Python that takes as input a number, the year, and determines if it is a leap year or not. The function should return True if it is a leap year and False otherwise. Part 2) Write a main function to test out your leap year function on a few different illustrative inputs.arrow_forward
- Assume that start and end are integers.Return the average all of the numbers from start to end inclusive.For example,average(3, 5) returns 4.0, since (3 + 5) / 2 = 4arrow_forwardQ/The following algorithm is to find and print the factorial of ten numbers, which of the following options are true? )1( ابدا )2( ضع قيمة 1=N )3( ضع قيمة 1=F )4( اقرا قيمة العد د x )5( افتح حلقة تكرار بقيمة ابتدائية 1=J وقيمة نهائية x وزيادة مقدارها 1 )6( أحسب قيمة F من المعادلة *F=F )7( عد إلى الخطوة رقم 5 لحين وصول العداد لقيمته النهائية )8( اطيع قيمة x و F )9( اضف قيمة واحد إلى العداد 1+N=N )10( إذا كانت قيمة 10=>N اذهب إلى الخطوة 3 والا اذهب إلى الخطوة 1 1 )1 1( توقف الخطوة 4 يجب أن تكون قبل الخطوة 3 لتكون الخوارزمية صحيحة الخطوة 3 يجب أن تكون بعد الخطوة 5 لتكون الخوارزمية صحيحة 0 الخوارزمية صحيحة تماما الخطوة 9 يجب أن تكون قبل الخطوة 8 لتكون الخوارزمية صحيحة )5( يوجد خطأ في الخطوة 10arrow_forwardA regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is Area = ( n * s2 ) / (4 * tan( π/n) Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT