# Pythogoreon Triplets
sum = 300
# For all values of a from (0, 300)
for a in range(sum + 1):
# For all values of b > a and b <
300
for b in range(a + 1, sum + 1):
# For all values of c
> b and c < 300
for c in range(b + 1,
sum + 1):
# If sum(a + b + c) == 300 and a^2 + b^2 = c^2
if (a + b + c == sum) and (a**2 + b**2 == c**2):
# Print the numbers
print(f'A : {a}, B : {b}, C : {c}')

# functions to calculate T based on odd or even
def calculateTEven(Ti):
return int(Ti * 0.5)
def calculateTOdd(Ti):
return int(0.5 * (3 * Ti + 1))
sequences = []
for T in range(1, 26):
T0 = T
seq = []
while True:
seq.append(T0)
if T0 == 1:
break
if(T0 % 2 == 0):
T0 = calculateTEven(T0)
else:
T0 = calculateTOdd(T0)
sequences.append(seq)
print(f'T0\tMaximum\t\tSeries')
for i in range(1, 26):
print(f'{i}\t {max(sequences[i -
1])}\t\t{sequences[i - 1]}')

import matplotlib.pyplot as plt
# get the number of elements in each sequence
seq_lengths = [len(seq) for seq in sequences]
# get the T0 (1 to 25)
starting_numbers = [i for i in range(1, 26)]
# plot the graph
plt.plot(starting_numbers, seq_lengths)
# Add title
plt.title("Starting Number VS Number of Elements in Seq")
# Add X label
plt.xlabel("Starting Number")
# Add Y Label
plt.ylabel("Number of Elements per sequence")
# Display the plot
plt.show()

Suppose we select some initial number ? and then build the sequence of values by the...
this is using MATLAB
2. Fibonacci sequence: A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1,1 and proceeds as follows: 1, 1, 2, 3, 5, 8, 13, . However, a Fibonacci sequence can be created with any two starting numbers. Create a MATLAB function called FL_fib_seq' (where F and L are your first and last initials) that creates a Fibonacci sequence. There should be three inputs. The first...
The Syracuse sequence is generated by starting with a natural number and repeatedly applying the following function until reaching 1: ???(?) = { ?/2 if x is even { 3? + 1 if x is odd For example, the Syracuse sequence starting with 5 is: 5, 16, 8, 4, 2, 1. It is an open question in mathematics whether this sequence will always go to 1 for every possible starting value. Write a function in Python (called syracuse) that gets...
IN PYTHON
1.Choose a positive integer
2. To get the next number in the sequence we do the following:
If the integer is odd, we multiply by 3 and add 1. If the integer
is even, we divide by 2. It is hypothesized that the above sequence
will always converge to the value of 1, regardless of any valid
initial choice. This hypothesis is known as the Collatz Conjecture.
For example, if we start at 5, the numbers generated by...
Fibonacci numbers – for loops We’ll define the Fibonacci numbers to be an integer sequence starting with 1, 1, and where each subsequent element is got by adding the previous two elements: 1, 1, 2, 3, 5, 8, . . . (Mathematicians start with 0, 1, . . . , but we want to avoid zeros because you can’t take their log. ) Write a python programme in a Jupyter notebook which uses a for-loop to fill an array with...
Suppose an array contains the sequence of values 4, 5, 6, 7, 8, and 10. If the binary search algorithm is used to search the array, how many elements must be visited to determine that element 3 is not in the array? Select one: a. 4 b. 6 c. 3 d. 5
In this assignment we are asking the user to enter two number values, the starting and ending numbers for our application. Having these values, we then construct a loop that will increment by one (1) from the starting number through (and including) the ending number. Within this loop we will check the current value of our number to see if it is evenly divisible by 3, then by 5, and then by both 3 and 5. We will output all...
Let's say you are given a sequence of distinct positive numbers. We want to find a subsequence with the maximum possible sum, with the restriction that we are not allowed to take three consecutive elements from the original sequence. For example, for input 1, 6, 5, 2, 7, 9, 3, 4, the subsequence with the maximum possible sum is 6, 5, 7, 9, 4 (we have two pairs of consecutive elements 6, 5 and 7, 9 but not three consecutive...
In this assignment we are asking the user to enter two number values, the starting and ending numbers for our application. Having these values, we then construct a loop that will increment by one (1) from the starting number through (and including) the ending number. Within this loop we will check the current value of our number to see if it is evenly divisible by 3, then by 5, and then by both 3 and 5. We will output all...
I want this using while loop
This using stringin python
Use list or some thing in python
Using list in python
I want answer as soon as posdible
E. Last Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard output You are given a sequence of positive integers aj, , 03, ... Print the last element of the sequence. Input The input consists of multiple lines. The i-th line contains a...
USING MATLAB
7. A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1, 1 and proceeds as follows: 1,1,2,3,5,8,13, So, if f(1)-1 and f(2) -1, then f(3)-2)+f(1) We can represent this pattern as f(x) - f(x-1)+f(x-2). A Fibonacci sequence can be created with any two numbers. Prompt the user to enter the first two numbers in a Fibonacci sequence and the total number of elements requested in the sequence....