A résolu


Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

presque 2 ans il y a

A résolu


High school cafeteria
Given an input vector of positive integers, return a row vector with the primes first (in increasing order) and the composites n...

presque 2 ans il y a

A résolu


Is my wife right?
Regardless of input, output the string 'yes'.

presque 2 ans il y a

A résolu


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

presque 2 ans il y a

A résolu


All your base are belong to us
Find the base _b_ logarithm of the input decimal number _x_. Express the output as a decimal number. The first argument is the n...

presque 2 ans il y a

A résolu


Cannon Ball
Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.

presque 2 ans il y a

A résolu


give nth decimal place of pi
max 15th place after the decimal point is ok for now

presque 2 ans il y a

A résolu


Least common multiple of many numbers
1:6 -> 60

presque 2 ans il y a

A résolu


Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

presque 2 ans il y a

A résolu


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

presque 2 ans il y a

A résolu


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

presque 2 ans il y a

A résolu


Add two numbers
Given a and b, return the sum a+b in c.

presque 2 ans il y a

A résolu


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

presque 2 ans il y a

A résolu


Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

presque 2 ans il y a

A résolu


Leap years on other planets
A year is a leap year if it is divisible by 4, but not if it is divisible by 100, unless it is also divisible by 400. This mean...

presque 2 ans il y a

A résolu


Hexagonal numbers on a spiral matrix
Put hexagonal numbers in a ( m x m ) spiral matrix and return the sum of its diagonal elements. Formula of hexagonal numbers ...

presque 2 ans il y a

A résolu


Determine if input is a Narcissistic number
<http://en.wikipedia.org/wiki/Narcissistic_number Narcissistic number> is a number that is the sum of its own digits each raised...

presque 2 ans il y a

A résolu


generate nth pentatope number
https://en.wikipedia.org/wiki/Pentatope_number

presque 2 ans il y a

A résolu


Sum of series IX
What is the sum of the following sequence: Σ 1/k! for k=1...n for different n?

presque 2 ans il y a

A résolu


Sum of series VIII

presque 2 ans il y a

A résolu


Sum of series VII
What is the sum of the following sequence: Σ(km^k)/(k+m)! for k=1...n for different n and m?

presque 2 ans il y a

A résolu


Sum of series
a(n) = n^2 - (n-1)^2 find the summation of the series upto n i.e. a(1)+a(2)+...+a(n)

presque 2 ans il y a

A résolu


Sum of series VI
What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

presque 2 ans il y a

A résolu


Sum of series IV
What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

presque 2 ans il y a

A résolu


Sum of series III
What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

presque 2 ans il y a

A résolu


Sum of series II
What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

presque 2 ans il y a

A résolu


Sum of series I
What is the sum of the following sequence: Σ(2k-1) for k=1...n for different n?

presque 2 ans il y a

A résolu


Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
If p is the perimeter of a right angle triangle with integral length sides, { a, b, c }, there are exactly three solutions for p...

presque 2 ans il y a

A résolu


factorial_calc(n)
Write a MATLAB function called factorial_calc(n) that takes a positive integer n as input and calculates the factorial of n. The...

presque 2 ans il y a

A résolu


A (wrong) place for everything, and everything in its (wrong) place
You have an equal number of cups and balls, each labelled from one to N. You randomly place one ball in each cup. Determine th...

presque 2 ans il y a

Charger plus