Concept explainers
If you take the value of N as computed in exercise 2, subtract 621,049 from it, and then take that result modulo 7, you get a number from 0 to 6 that represents the day of the week (Sunday through Saturday, respectively) on which the particular day falls. For example, the value of N computed for August 8, 2004, is 732.239 as derived previously. 732,239 – 621,049 gives 111,190. and 111,190 % 7 gives 2, indicating that this date falls on a Tuesday.
Use the functions developed in the previous exercise to develop a
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Programming in C
Additional Engineering Textbook Solutions
Database Concepts (8th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Absolute Java (6th Edition)
Java How To Program (Early Objects)
Starting Out with Python (3rd Edition)
Computer Science: An Overview (12th Edition)
- A number is divisible by 11 if the difference of the sum of its digits at odd places and the sum ofits digits at even places is either 0 or divisible by 11.For example, for 2547039:(Sum of digits at odd places) - (Sum of digits at even places) = (9 + 0 + 4 + 2) - (3 + 7 + 5) = 0So 2547039 is divisible by 11.But for 13165648:(Sum of digits at odd places) - (Sum of digits at even places) = (8 + 6 + 6 + 3) - (4 + 5 + 1 + 1) = 1212 is not divisible by 11 so 13165648 is also not divisible by 11.Sample run:Give your number: 13165648Total is: 1213165648 is not divisible by 11.arrow_forwardA number is divisible by 11 if the difference of the sum of its digits at odd places and the sum ofits digits at even places is either 0 or divisible by 11.For example, for 2547039:(Sum of digits at odd places) - (Sum of digits at even places) = (9 + 0 + 4 + 2) - (3 + 7 + 5) = 0So 2547039 is divisible by 11.But for 13165648:(Sum of digits at odd places) - (Sum of digits at even places) = (8 + 6 + 6 + 3) - (4 + 5 + 1 + 1) = 1212 is not divisible by 11 so 13165648 is also not divisible by 11.arrow_forwardThe Problem A Zeckendorf number is defined for all positive integers as the number of Fibonacci numbers which must be added to equal a given number k. So, the positive integer 28 is the sum of three Fibonacci numbers (21, 5, and 2), so the Zeckendorf number for k = 28 is three. Wikipedia is a satisfactory reference for our purposes for more details of the Zeckendorf and Fibonacci numbers. In both cases, you do not need to read the entire Wikipedia entry. Your assignment is to write two ARM assembly language functions which calculate Zeckendorf and Fibonacci numbers. Zeck function The first function, which should be named zeck, receives an integer parameter in register zero. This will be the variable k we discussed above. Your code should return the Zeckendorf number for k in register zero when complete. If the parameter k is zero, return zero. If the parameter k is negative, return minus 1. If the parameter k is too large to calculate, return minus 1. Fib function The other function,…arrow_forward
- For each number n from 1 to 4, compute n2 mod 5. Then for each n, compute n3 mod 5 and finally n4 mod 5. Do you notice anything surprising? (You may need to go past n = 4 to see a pattern)arrow_forwardLet n be an integer. If 3n+ 4 is odd, then n is odd.arrow_forwardThe Fibonacci sequence is listed below: The first and second numbers both start at 1. After that, each number in the series is the sum of the two preceding numbers. Here is an example: 1, 1, 2, 3, 5, 8, 13, 21, ... If F(n) is the nth value in the sequence, then this definition can be expressed as F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 F(5) = 5 F(6) = 8 F(7) = 13 F(8) = 21 F(n) = F(n - 1) + F(n - 2) for n > 2 Example: Given n with a value of 4F(4) = F(4-1) + F(4-2)F(4) = F(3) + F(2)F(4) = 2 + 1F(4) = 3 The value of F at position n is defined using the value of F at two smaller positions. Using the definition of the Fibonacci sequence, determine the value of F(10) by using the formula and the sequence. Show the terms in the Fibonacci sequence and show your work for the formula.arrow_forward
- The Fibonacci sequence is defined as follows: ϕ0=0, ϕ1=1, ϕn=ϕn−1+ϕn−2. ϕ0=0, ϕ1=1, ϕn=ϕn−1+ϕn−2. Given an integer a, determine its index among the Fibonacci numbers, that is, print the number n such that ϕn=a. If a is not a Fibonacci number, print -1 . WRITE THE CODE IN PYTHON PLEASEarrow_forwardWorking with cell addresses The address of a cell in Google sheets can be specified in two ways: either as a letter-number pair like C5, or as a pair of numbers like "row 5, column 3". Some formulas may be easier to specify on one way or the other, so it's useful to know how to convert from one form to the other and back. ROW() and COLUMN() take addresses in A1 format and return the number of the row and column respectively. ADDRESS() takes numeric row and column inputs and returns the address in A1 format. It also has an option argument to specify the relativity of the addresses: 1 (the default) returns absolute addresses; 2, 3, and 4 return row absolute, column absolute, and relative addresses respectively. In this chapter you'll be working with Indian butterfly data from Singh and Pandey. Instructions In column H, get the row numbers of the Locality column. In column I, get the column numbers of that column. In column J, convert columns H and I back to addresses in $A$1…arrow_forwardlet n = 1*3*5*....*197*199 (the product of first 100 odd numbers) find the last 2 digits of narrow_forward
- Given a positive integer, N, the ’3N+1’ sequence starting from N is defined as follows: If N is an even number, then divide N by two to get a new value for N. If N is an odd number, then multiply N by 3 and add 1 to get a new value for N. Continue to generate numbers in this way until N becomes equal to 1. For example, starting from N = 3 the complete ’3N+1’ sequence would be:3, 10, 5, 16, 8, 4, 2, 1 Do the following: Write a code in C++ to ask the user to enter a positive integer (N) in the main() function. Write a function sequence() that receives the integer value N and display the ‘3N+1’ sequence starting from the integer value that wasreceived (entered by the user). The function must also count and return the numbers that the sequence consists of. The returned value must be displayed from the main() function. Example input and output is given in the following image.arrow_forwardStarting with the first Fibonacci number, Fib(1) = 1, and the second Fibonacci number, Fib(2) = 1, what is the sum of Fib(8) and Fib(10)?arrow_forwardYou need to take a trip by car to another town that you have never visited before. Therefore, you are studying a map to determine the shortest route to your destination. Depending on which route you choose, there are five other towns (call them A, B, C, D, E) that you might pass through on the way. The map shows the mileage along each road that directly connects two towns without any intervening towns. These numbers are summarized in the following table, where a dash indicates that there is no road directly connecting these two towns without going through any other towns. Miles between Adjacent Towns Town A B C DE Destination Origin A 40 60 50 10 70 B 20 55 40 50 10 D 60 E 80 (a) Formulate this problem as a shortest-path problem by drawing a network where nodes represent towns, links represent roads, and numbers indicate the length of each link in miles. (b) Use the Dijkstra's algorithm to solve this shortest path problem.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education