Reference no: EM13168544
The Collatz conjecture concerns what happens when we take any positive integer n and apply the following algorithm:
n= n/2, if n is even
3 × n + 1, if n is odd
The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1. For example, if n = 35, the sequence is 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1
Write a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line. For example, if 8 is passed as a parameter on the command line, the child process will output 8, 4, 2, 1. Because the parent and child processes have their own copies of the data, it will be necessary for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program. Perform necessary error checking to ensure that a positive integer is passed on the command line.
Create a class named blooddata that includes fields
: Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor (the factors are + and -). Create a default constructor that sets the fields to "O" and "+", and an overloaded c..
|
Recursive method
: What will happen when the following recursive method is executed with an initial input value of 10?public int recursiveMethod(int input)
|
Calculate the concentration of sodium ions
: Calculate the concentration (M) of sodium ions in a solution made by diluting 50.0 mL of a 0.874 M solution of sodium sulfide to a total volume of 250.0 mL
|
Will compute the value of each piece of clothing.
: write a script in MATLAB that will compute the value of each piece of clothing.
|
Write a c program using the fork() system
: Write a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line. For example, if 8 is passed as a parameter on the command line, the child process will ou..
|
Work out from the molar mass
: An antacid tablet contains 0.1 g of magnesium hydrogencarbonate, Mg(HCO3)2. What mass of stomach acid, HCl, will it neutralise? The reaction between Mg(HCO3)2 and HCl is: Mg(HCO3)2 + 2HCl → MgCl2 + 2CO2 + H2O
|
What mass of carbon monoxide in grams is present
: What mass of carbon monoxide in grams is present in a room measuring 8.5 12.0 18.4 ft ?
|
Data validation refers to checking the content
: Data validation refers to checking the content of data to ensure that it satisfies certain rules, known as constraints. For example, the employee name should never be omitted in the employee table, and the delivery date should be after (greater th..
|
Which volume of gas decomposition one mole of sodium azide.
: Sodium azide, NaN3 , is made for use in car 'air bags'. When this compound is heated to 300 degrees celsius, it rapidly decomposes into its elements.
|