1. Fibonacci The Fibonacci numbers are a sequence of numbers where each number after the first two is a sum of the prior two. As an illustration, here is a short sequence given starting values of (0, 1): Fibonacci series = (0, 1, 1, 2, 3, 5, 8, 13). Given an integer n, calculate the firstn numbers in the Fibonacci sequence given starting elements of (0, 1). Return an array of nintegers, including the given (0, 1) in the sequence.
Q: Nearest polygonal number def nearest_polygonal_number(n, s): Any positive integer s > 2…
A: def nearest_polygonal_number(n, s): return int(((s-2)*n**2 - (s-4)*n)/2) n=int(input("\n\t Enter…
Q: using python language Create the following list of numbers: [3,7,5,2,9,7] Write a while loop that…
A: Algorithm: 1. Start 2. Initialize list 3. Initialize i to 0 4. Check while loop condition 5. If…
Q: Girl Scout Troop 815 has 18 members. Write a program in which the troop leader can enter the number…
A: Please find the answer to the above question below:
Q: Lucky Pairs Richie and Raechal are participating in a game called "Lucky pairs" at the Annual Game…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read A,B,N values…
Q: Morse code is a code where each letter of the English alphabet, each digit, and various punctuation…
A: Morse code is a method used in telecommunication to encode text characters as standardized sequences…
Q: Let n be a positive integer consisting of up to ten digits, d10, d9 ,…..,d1. Write a Phyton program…
A: The list is a data structure in which it is a collection of items and the list is mutable. The items…
Q: 23. A perfect number is a positive integer that is equal to the sum of its positive divisorsexcept…
A: The below given java program will obey the following rubrics:Importing essential header…
Q: Initialize a string of size 40. Write a program that prints all unique alphabets from string. After…
A: Actually, string is a sequence of characters.
Q: Some sample runs of the program are included below (user input is in bold): > java ThreeWords Enter…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Add a while loop to the Imperial BMI procedure below. def BMIImperial(height, weight, bmiList,…
A: First Step is declare bmiList and Category list and pass height, weight, bmiList and Category in the…
Q: Task 5. Write a program to print Fibonacci series up to a given n terms. Note: The Fibonacci…
A: Solution :
Q: 8. You live in a village. The village can be represented as a line that contains n grids. Each grid…
A: C code with output provided below:
Q: I'm running a 5-star restaurant and I can only have the best items on my menu. My menu offers 6…
A: Q: Code the given problem
Q: in alphabetical order on adjustable height shelves. Each book has a height and a thickness. The…
A: You are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and…
Q: Nearest polygonal number def nearest_polygonal_number(n, s): Any positive integer s > 2 defines an…
A: Given the number of sides s and an arbitrary integer n, this function should return the s-gonal…
Q: 7. a) Write down the 5 by 5 adjacency matrix for the undirected graph below (Figure 1). A C E B…
A: The following is the adjacency matrix for the given graph: A B C D E A 0 1 1 0 0 B 1 0 1 1…
Q: Consider the list origlist [45, 32, 88] Select below all the instructions that add the string "cat"…
A: Option a) It's syntax is wrong so it will not add the string cat. b) It's syntax is also wrong so it…
Q: Exercise 2: A simple bar chart A bar chart is a good choice when you want to show how some quantity…
A: Matplotlib is used to draw graphical visuals in python programming language. A bar chart shows…
Q: Make Camel Case. Create a program that reads a multi-word phrase, and prints the Camel Case…
A: Algorithm: Start Read a string Split the string using space Initialize s="" Convert the first word…
Q: II. Integer Riddle To solve the Integer Riddle, fill in the answers to the clues, with one letter in…
A: Data is defined as facts or figures, or information that's stored in or used by a computer. A bit is…
Q: 1. The maximum difference between any two subsequent (right next to each other) numbers in the list…
A:
Q: P1 P2 P3 P4 A pentagonal number is one that corresponds to dots arranged into a pentagon. Above are…
A: Solution :: The solution for finding pentagon number is to find using recursion, as to calculate…
Q: There is a simple card game played with a deck of cards where a player receives four cards and two…
A: Python 3 def createSystematicList(): cards=[] '''Since there are only 4 cards the…
Q: 8. You live in a village. The village can be represented as a line that contains n grids. Each grid…
A: Each person can reach 1 grid. People can only access their homes. Note that HB.BH also works. Each…
Q: Expand positive integer intervals def expand_intervals(intervals): An interval of consecutive…
A: Code: from typing import List, NoReturn, Any def collapse_intervals(items: List[int]) -> str:…
Q: Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns…
A: 1. Taking variable i and x for iterating in loops . 2. Using the for loop and checking if i is less…
Q: const int SIZE = 7; int studyHours [SIZE]={3, 2, 4, 2, 4, 5, 3}; string day[SIZE] = {"Monday",…
A: answer is Study hour for the student one Wednesday is 4 Reason: indexing in array always starts…
Q: 1) Store the following data into a tuple, colors: red, green, 2) Store the following data into a…
A: colors=("red","green"); shapes=["rectangle","circle"]; #if there is no spacingprint("colors:…
Q: The popularity ranking of baby names over the last 100 years (1920-2019) is downloaded from…
A: The class name is BabyNames. So to run the code, the commands will be javac BabyNames.java and then…
Q: Exercise 2. (Pascal's Triangle) Pascal's triangle Pn is a triangular array with n+1l rows, each…
A: Coded using Python 3.
Q: OddFib.py 1 #Recall that Fibonacci's sequence is a sequence of numbers 2 #where every number is the…
A: Step-1: StartStep-2: Call function oddfib and pass 3 as an argument, print return valueStep-3: Call…
Q: 6- You have two numbers ABCD and WXYZ (ex: 2345 and 7965). Write an algorithm using Pseudocode that…
A: Given data is shown below:
Q: Question 18 D The following question uses a robot in a grid of squares. The robot is represented as…
A: The following code segment moves the robot around the grid. Assume that n is a positive integer.…
Q: 6. A certain game keeps track of the maximum and minimum scores obtained so far. If num represents…
A: The given scenario is to update the value of "num" by the minimum and maximum scores. The variable…
Q: Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns…
A: 1.Start 2.Declare variables. 3.Create an object of Scanner class to take input from user. 4.Take…
Q: age/plot an gif to this code. This is a brownian motion python code here it is code import numpy…
A: It is defined as a powerful general-purpose programming language. It is used in web development,…
Q: Rust Lab Assignment - 2 Write a program to compute the sum of all even natural numbers in the range…
A: Here I have created a variable to store the sum of even numbers. Next, I have used a for loop to…
Q: 1. Starting with the leftmost digit, double it and then double every other digit after it. However,…
A: code is given below
Q: 1. Given the following list, trace the given code and draw the list afterward. SHOW YOUR WORK . head…
A: Let's start from the line one, Here we have, p = head (very first node) q = here we have address for…
Q: . Write a program that reads from the user an integer matrix with 10x10, and then rotate that matrix…
A: Required: Write a program that reads from the user an integer matrix with 10x10, and then rotate…
Q: Manhattan skyline def manhattan_skyline(towers): This classic problem in computational geometry…
A: Given:
Q: 1- The integers from 100 down to 0 by fives; that is, the first three lines should be 100, 95, 90,…
A: The program used the for loop to print the numbers fro 100 to 0 multiples of 5. For loop starts from…
Q: 4. Use a for loop to print a list containing your name, enrollment number, state, date of birth,…
A: 4. The current scenario here is to write the r programming code to print a list that containing the…
Q: Create a function that returns the nth catalan number.In combinatorial mathematics, the Catalan…
A: As language is not defined, doing it in Python
Q: Combine the first name, middle name, and last name and assign it as the 'fullname' of the hero. If…
A: Implementing given program in C++.
Q: In computational geometry, often you need to find the rightmost lowest point in a set of points.…
A: Given program allow user to enter the coordinates of six points and display the rightmost lowest…
Q: 3. Randomly generate a number in range [1, 12]. Map this number to a season: if the number is 3, 4,…
A: The random numbers can be generated in Java using the objects of the predefined Random class. This…
Q: 15. Use sets to find the two six-digit numbers with all different digits where the square of the…
A: c=0for i in range(100000,1000000): s=set(list(map(int, str(i)))) if len(s)==6: m=i*i…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- In the example below, the sum of the fourth powers of each digit that forms the 4-digit numbers gives the number itself: 1634 = 14 + 64 + 34 + 44 8208 = 84 + 24 + 04 + 84 9474 = 94 + 44 + 74 + 44 And sum of these numbers is 1634 + 8208 + 9474 = 19316. Find the sum of all numbers that can be written as the sum of the fifth forces of their numbers. (P.s.: You have to done it by C++)C++ 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 Write code 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 was received (entered by the user). The function must also count and return the numbers that the sequenceconsists of. The returned value must be displayed from the main() function.1.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 NIf 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 1For example, starting from N = 3 the complete ’3N+1’ sequence would be:3, 10, 5, 16, 8, 4, 2, 1Write c++ code 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 sequenceconsists of. The returned value must be displayed from the main() function.
- In python, Problem Description:Sheldon and Leonard are physicists who are fixated on the BIG BANG theory. In order to exchange secret insights they have devised a code that encodes UPPERCASE words by shifting their letters forward. Shifting a letter by S positions means to go forward S letters in the alphabet. For example, shifting B by S = 3 positions gives E. However, sometimes this makes us go past Z, the last letter of the alphabet. Whenever this happens we wrap around, treating A as the letter that follows Z. For example, shifting Z by S = 2 positions gives B. Sheldon and Leonard’s code depends on a parameter K and also varies depending on the position of each letter in the word. For the letter at position P, they use the shift value of S = 3P + K. For example, here is how ZOOM is encoded when K = 3. The first letter Z has a shift valueof S = 3 × 1 + 3 = 6; it wraps around and becomes the letter F. The second letter, O, hasS = 3 × 2 + 3 = 9 and becomes X. The last two letters…IN VISUAL BASIC, solve Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.A finite sequence of symbols from a given alphabet will be called a string over the alphabet. A string that consists of a sequence a1, a2, a3, a4, … … … … , ?? of symbols will be denoted by the juxtaposition a1 a2 a3 a4 … … … … ??. Given the strings: ? = a2bab2and v = bab2, Evaluate the following operations for strings: (i) ԑu(ii) u + v(iii) u(u| v)(iv) v | (v | u)
- Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion:A, B, and C = 2D, E, and F = 3G, H, and I = 4J, K, and L = 5M, N, and O = 6P, Q, R, and S = 7T, U, and V = 8W, X, Y, and Z = 9Create an application that lets the user enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663.1. Let L = {w {a, b}* : w contains bba as a substring that starts in an odd numbered position in the string (where numbering starts at 1)}. For example, bbbbaaaab L, while bbbaaaab L. Show an NDFSM that accepts LGiven a string str and number n, write a program in Javascript that recursively appends a copy of string str n times and returns the resulting string in a sentence explaining whether the resulting string has an odd or even amount of the passed in str. For example: RecuriveCopy("a", 10)//-> "aaaaaaaaaaa has a(n) odd number of a's"RecursiveCopy("blah",5)//-> "blahblahblahblahblahblah has a(n) even number of blah's" Please complete the following function:function RecursiveCopy(str, n) {// your code here} The problem must satisfy the following: You must use recursion. You should end up with n+1 copies of the str total in the output because you are appending additional str copies. Use string literal formatting for the output
- Factorial of a number is defined as: n! = n(n-1)(n-2)(n-3)...(2)(1) For example, 4! = 4*3*2*1 The n! can be written in terms of (n-1)! as: n! = n* (n-1)! (n-1)! = (n-1)*(n-2) ! and so forth. Thus, in order to compute n!, we need (n-1)!, to have (n-1)!, we need (n-2)! and so forth. As you may immediately notice, the base case for factorial is 1 because 1! = 1. Write a program that uses a recursive function called factorial that takes an integer n as its argument and returns n! to the main. C++ PLEASEint a[10] = {0,1,2,3,4,5,6,7,8,9};int *m = &a[0];int *p = &a[5];int *q = &a[1]; p = (int) m + (int) p - (int) q; what is the value of of *pA geometric sequence is a sequence of numbers where each term after the first isfound by multiplying the previous one by a fixed, non -zero number calledthe common ratio. For example, the sequences2, 6, 18, ....3,15,75, ….are a geometric sequences with common ratios 3 and 5 respectively. A geometricsequence is generally characterized by three numbers, the first term ‘a’, thecommon ratio ‘r’ and the number of terms ‘n’. A geometric series is the sum ofnumbers in a geometric sequence. 2+6+18 and 3+15+75 are examples of geometricseries with three terms each.The nth term of a geometric series with initial value ‘a’ and common ratio ‘r’ isgiven by: ?? = ???-1. While the sum of a geometric series is given by:?(1 - ??)1 - ?Create a class GeometricSeries to model a Geometric series. Using friend function,overload the ‘~’ operator to find the nth term of the series. Likewise, overload the‘!’ operator (using a friend function) to find the sum of a Geometric series.Provide a function display() in…