1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TEA [102]
3 years ago
13

g Write a recursive function, seq_of_mult_3, which models the recursive function that generates the sequence = {2, 6, 18, 54, 16

2 ...}. The function should take in the one input parameter that represents the nth value to calculate.
Computers and Technology
1 answer:
Harlamova29_29 [7]3 years ago
7 0

Explanation:

In computer programming, a recursive function is one that calls itself and breaks when a certain condition is met, otherwise it keeps on running.

IN the given scenario, the recursive formula would be;

an = 3an - 1

Here n is nth term, an is the An value of function for nth term and An-1 is for one previous value.

global

int nth_val

int curr_val

int output = 2

def recursive(nth_val):

{

While ( curr_val < nth_val)

          Print (Output)

           Output = Output x 3;

curr_val++;

recursive(nth_val):

break

}

Int main void

{

Int number;

number = input("Please input the nth number of series: ")

nth_val = number

recursive(nth_value):

}

You might be interested in
eplace the underlines with the words in parentheses that follow: The ____ solves the ____ of a ____ by expressing an ____ in a _
SOVA2 [1]

Answer: Following are the sequence-wise answers to blanks :

1)programmer

2)problems

3)user

4)algorithm

5)programming language

6)program

7)computer

Explanation:

To solve any situation, firstly an algorithm is designed which can be in English as well and its optimized and a language is chosen according to the system's configuration and many factors and then that algorithm is converted to code in same language chosen. This is how a user's situation is solved using programming by a coder or programmer.

4 0
3 years ago
Judy is searching for files with a .jpg file extension on her laptop. Which type of file is she looking for?
nikklg [1K]
<span>JPEG files </span><span> are a common file format for digital photos and other digital graphics so she would be looking for a picture

</span>
6 0
3 years ago
Read 2 more answers
Consider the following recursive method. public static string recur(int val) { string dig = "" + (val % 3); if (val / 3 &gt; 0)
Oksana_A [137]

The recursive method recur executes itself from within

When the statement System.out.println(recur(32)); is executed, the string value "2101" is printed

<h3>How to determine the output of the statement?</h3>

The flow of the program is as follows:

  • The method keeps updating the string variable dig with the remainder of the val variable divided by 3
  • When the remainder is less than or equal to 0, the method is exited

So, when 32 is divided by 3.

The remainders are 2, 1, 0 and 1

So, the output of the statement is "2101"

Read about java methods at:

brainly.com/question/19271625

5 0
2 years ago
Why might you use the "search network campaigns with display opt-in" campaign type?
slava [35]
The answer is:
You can use one budget to advertise on the Search Network and Display Network
5 0
3 years ago
Read 2 more answers
Write a method named printOdd() that accepts an integer array as argument and print all the odd numbers in the array. You may as
Hoochie [10]

Answer & Explanation:

//written in java

public class Main {

   private static void printOdd(int[] list) {

       for (int value : list) {

           if (value % 2 == 1) {

               System.out.println(value);

           }

       }

   }

   public static void main(String[] args) {

       printOdd(new int[]{5, 6, 2, 3, 11, 4, 7});

   }

}

8 0
4 years ago
Other questions:
  • How many possible values will an eight bit audio sample have
    14·1 answer
  • X=10 ;
    14·1 answer
  • The width of a strand of fiber is 19.2 micrometers. if 1500 strands are adhered side by side, how wide would the resulting fabri
    9·1 answer
  • Which of the following statements about certificates is true?
    14·2 answers
  • SAN Security Issues: What storage security issue might come to be a greater problem in the future?
    10·1 answer
  • A large lens can be very heavy and can only be supported at the_______.
    13·1 answer
  • Seeing her Daughter graduate from college is most likely a short term goal for a person of which of these ages ? A) 24 years old
    10·1 answer
  • List out various computer generation long with their basic characteristic ​
    13·1 answer
  • Write its features:features of computer ​
    15·1 answer
  • PYTHON CODING QUESTION
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!