Please find the code below:
isPrimeNumber.m
function [ result] = isPrimeNumber( n )
%%initially set output flag to true
result = true;
%%iterate over all positive integers 2,3,...,n-1
%%if n is not divisible by any of these factors....it is
prime
if (n == 1)
result = false;
elseif (n == 2)
result = true;
else
for i=2:n-1
if (mod(n,i)==0)
result = false;
break;
end
end
end
end
Script
clc
clear
%generate even random number
evenNum = 4+randi(96);
while rem(evenNum,2)==1
evenNum = 4+randi(96);
end
fprintf("Generated even number is %d\n",evenNum);
one = [];
two = [];
for num=1:evenNum
if isPrimeNumber(num)
other = evenNum-num;
if isPrimeNumber(other)
if ~ismember(num,one) && ~ismember(other,one)
one = [one num];
two = [two other];
end
end
end
end
fprintf("The prime nubers factors are as below\n");
for i=1:length(one)
fprintf("%d - %d\n",one(i),two(i));
end
output:

matlab The Goldbach Conjecture asserts that every even integer greater than 2 can be expressed as...
in PythonThe Goldbach conjecture asserts that every even number is the sum of two prime numbers. Write a program that gets a number from the user, checks to make sure that it is even, and then finds two prime numbers that add up to the number.
Goldbach's Conjecture The goal of this program is to find all unique ways to represent a given even number as the sum of two prime numbers. A prime number is an integer greater than 11 that is evenly divisible by only itself and 11. The first few prime numbers are 22, 33, 55, 77, 1111, …. The German mathematician Christian Goldbach (1690-1764) conjectured that every even number greater than 22 can be represented by the sum of two prime numbers....
write the code in C please
4. Write a logical function perfect Square that receives a positive integer number and checks if it is a perfect square or not. Note: perfect square numbers are 4, 9,16,25,36 etc.... Write a main function that makes use of the perfect Square function to find and print all perfect squares between nl and n2. nl and n2 are end values of a range introduced by the user. ■ (inactive CAT EXE) Enter end values...
Python language:Given n an even positive integer (greater than or equals to the number 4) proposed by the user, the algorithms prints two prime numbers p and q such that the equality relation p + q = n is satisfied
PYTHON! The Sieve of Eratosthenes THANKS FOR
HELP!
A prime integer is any integer greater than 1 that is evenly
divisible only by itself and 1. The Sieve of Eratosthenes is a
method of finding prime numbers. It operates as follows:
Create a list with all elements initialized to 1 (true). List
elements with prime indexes will remain 1. All other elements will
eventually be set to zero.
Starting with list element 2, every time a list element is found...
public static List sumOfDistinctCubes(int n) Determine whether the given positive integer n can be expressed as a sum of cubes of positive integers greater than zero so that all these integers are distinct. For example, the integer n = 1456 can be expressed as sum 11 3 + 5 3 . This method should return the list of these distinct integers as a list [11, 5] with the elements given in descending order. If n cannot be broken into a...
Write a program “hw4.c” that reads integer (less than or equal 100) from the keyboard and, on the output, writes the sum of the divisors of n (other than itself). For integers less than or equal to 1 it should print 0. For example, the input -3 0 1 4 5 6 12 should generate the output 0 0 0 3 1 6 16 Explanation of output: The input -3 is less than 1, output is 0. The input 0...
import java.util.*;
public class PairFinder {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Read in the value of k
int k = Integer.parseInt(sc.nextLine());
// Read in the list of numbers
int[] numbers;
String input = sc.nextLine();
if (input.equals("")) {
numbers = new int[0];
} else {
String[] numberStrings = input.split(" ");
numbers = new int[numberStrings.length];
for (int i = 0; i < numberStrings.length; i++) {
numbers[i] = Integer.parseInt(numberStrings[i]);
}
}
System.out.println(findPairs(numbers, k));
}
//method that...
From previous homework you are already familiar with the math function f defined on positive integers as f(x)=(3x+1)/2 if x is odd and f(x)=x/2 if x is even. Given any integer var, iteratively applying this function f allows you to produce a list of integers starting from var and ending with 1. For example, when var is 6, this list of integers is 6,3,5,8,4,2,1, which has a length of 7 because this list contains 7 integers (call this list the Collatz list for 6). Write a C or C++...
Rational Number *In Java* A rational number is one that can be expressed as the ratio of two integers, i.e., a number that can be expressed using a fraction whose numerator and denominator are integers. Examples of rational numbers are 1/2, 3/4 and 2/1. Rational numbers are thus no more than the fractions you've been familiar with since grade school. Rational numbers can be negated, inverted, added, subtracted, multiplied, and divided in the usual manner: The inverse, or reciprocal of...