Community Profile

# RA

### McMaster University

236 total contributions since 2014

View details...

Contributions in
View by

Solved

Project Euler: Problem 2, Sum of even Fibonacci
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

ongeveer 2 jaar ago

Solved

Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

ongeveer 2 jaar ago

Solved

Integer Sequence - II : New Fibonacci
Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also ...

ongeveer 2 jaar ago

Solved

Compute Fibonacci Number
Compute the _n_-th Fibonacci Number f(0) = 0, f(1) = 1, f(2) = 1, f(3) = 2, ... f(42) = 267914296

ongeveer 2 jaar ago

Solved

Determine if a Given Number is a Triangle Number
*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

ongeveer 2 jaar ago

Solved

Mersenne Primes
A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prim...

ongeveer 2 jaar ago

Solved

Create a Multiplication table matrix...
Create a product table in this format: P = [ 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 1...

ongeveer 2 jaar ago

Solved

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

ongeveer 2 jaar ago

Solved

Divide by 4
Given the variable x as your input, divide it by four and put the result in y.

ongeveer 2 jaar ago

Solved

Largest Twin Primes
<http://en.wikipedia.org/wiki/Twin_prime Twin primes> are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Giv...

meer dan 6 jaar ago

Solved

Count ones
Write a program to count number of ones (1s) in an integer variable input. For example: Input x=2200112231 output y=3 I...

meer dan 6 jaar ago

Solved

Fahrenheit to Celsius converter
Convert Fahrenheit to Celsius degrees.

meer dan 6 jaar ago

Solved

Determine the number of odd integers in a vector
Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

meer dan 6 jaar ago

Solved

interesting center of magic matrix
output the centre of magic matrix of n input=7; output=25

meer dan 6 jaar ago

Solved

index of n^2 in magic(n)
input=5 magic matrix 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 ...

meer dan 6 jaar ago

Solved

Number of odd and even elements within matrix
Input(m) - any matrix with integers Output(n) - n(1)=number of odd elements, n(2)=number of even elements Example: * m=...

meer dan 6 jaar ago

Solved

Tiling a matrix
Given a matrix and a number of columns, replicate matrix in a single row

meer dan 6 jaar ago

Solved

index of n in magic(n)
let input=5; magic matrix 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 ...

meer dan 6 jaar ago

Solved

Find the square of the sum of the digits of a number
If a number (n) is provided as an input, find the square of the sum of the digits of the number. Example If n = 21, the an...

meer dan 6 jaar ago

Solved

Put Two 1D matrices into one 1D matrix
Example: If input a = [1 2 3 4 5]; input b = [10 9 8 7 6]; then output will be, y_correct = [1 10 2 9 3 8 4 7 5...

meer dan 6 jaar ago

Solved

Concatenate two strings
Its very easy. Just concatenate two strings.

meer dan 6 jaar ago

Solved

Symmetric matrix
You must create a n-by-n *symmetric* matrix such that A(row,col) = row/col for col >= row. Example if n =3 : output is : ...

meer dan 6 jaar ago

Solved

Upper triangular matrix
Create a function to retrieve the upper triangular matrix of a matrix (without using tril). The matrix will always be square. ...

meer dan 6 jaar ago

Solved

Find the dimensions of a matrix
Just find the number of columns of the given matrix. Example x = [1 2 3 4 5 6] y = 2

meer dan 6 jaar ago

Solved

Switch matrix to a column vector
for e.g. x = [1 2 3 4] y = 1 3 2 4

meer dan 6 jaar ago

Solved

Generate pi using logarithm
Generate pi using logarithm

meer dan 6 jaar ago

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.
The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

meer dan 6 jaar ago

Solved

Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

meer dan 6 jaar ago

Solved

Find nth maximum
Find nth maximum in a vector of integer numbers. Return NaN if no such number exists. x = [2 6 4 9 -10 3 1 5 -10]; So ...

meer dan 6 jaar ago

Solved

N-Cards Problem
You have a deck of _N_ cards numbered in order from 1 to _N_. You discard the top card (card 1) and place the next card (card 2)...

meer dan 6 jaar ago