Nick1982
On this page, you find all documents, package deals, and flashcards offered by seller nick1982.
- 32
- 0
- 4
Community
- Followers
- Following
37 items
Matlab Cody Problem 37. Pascal's Triangle


Given an integer n >= 0, generate the length n 1 row vector representing the n-th row of Pascal's Triangle.

Examples:

 pascalTri(0)
 ans =
 1

 pascalTri(1)
 ans =
 1 1

 pascalTri(2)
 ans =
 1 2 1


- Package deal
- Answers
- • 2 pages •


Given an integer n >= 0, generate the length n 1 row vector representing the n-th row of Pascal's Triangle.

Examples:

 pascalTri(0)
 ans =
 1

 pascalTri(1)
 ans =
 1 1

 pascalTri(2)
 ans =
 1 2 1


5 matlab cody problems Vol 1
Problems 72 , 29 , 44384 , 44305 , 2736 
with full functional code . Just copy and paste to the provided links and complete the problems mentioned above!
- Package deal
- • 5 items •
Problems 72 , 29 , 44384 , 44305 , 2736 
with full functional code . Just copy and paste to the provided links and complete the problems mentioned above!
Matlab Cody Problem 72 . Interpolator
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end) find the a(n), a(n 1) that flank it. Now interpolate the value, vb, such that it is proportionally between b(n) and b(n 1).
va can land exactly on a value of a.
For the exact link of the problem go to : 
https://www.mathworks.com/matlabcentral/cody/problems/72-interpolator

- Package deal
- Answers
- • 2 pages •
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end) find the a(n), a(n 1) that flank it. Now interpolate the value, vb, such that it is proportionally between b(n) and b(n 1).
va can land exactly on a value of a.
For the exact link of the problem go to : 
https://www.mathworks.com/matlabcentral/cody/problems/72-interpolator

Matlab Cody Problem 29. Nearest Numbers
Problem 29. Nearest Numbers
Created by Cody Team in Cody Challenge

Given a row vector of numbers, find the indices of the two nearest numbers.

Examples:

 [index1 index2] = nearestNumbers([2 5 3 10 0 -3.1])

 index1 =
 1
 index2 =
 3

 

- Package deal
- Answers
- • 2 pages •
Problem 29. Nearest Numbers
Created by Cody Team in Cody Challenge

Given a row vector of numbers, find the indices of the two nearest numbers.

Examples:

 [index1 index2] = nearestNumbers([2 5 3 10 0 -3.1])

 index1 =
 1
 index2 =
 3

 

Matlab Cody Problem 44384 . Find the nearest prime
Happy 5th birthday, Cody! Since 5 is a prime number, let's have some fun looking for other prime numbers.

Given a positive integer x, find the nearest prime number. Keep in mind that the nearest prime may be less than x.
- Package deal
- Answers
- • 2 pages •
Happy 5th birthday, Cody! Since 5 is a prime number, let's have some fun looking for other prime numbers.

Given a positive integer x, find the nearest prime number. Keep in mind that the nearest prime may be less than x.
Matlab Cody Problem 44305. 5 Prime Numbers

Your function will be given lower and upper integer bounds. Your task is to return a vector containing the first five prime numbers in that range that contain the number five. But, if you can't find at least five such numbers, the function should give up and return -1.

For example, for n_min = 60 and n_max = 1000, the set of prime numbers is:

 p = [61,67,71,73,79, ... 149,151,157,163, ... 241,251,257,263, ... 349,353,359,367, ... 983,991,997]

This set contains at least five numbers that c...
- Package deal
- Answers
- • 2 pages •

Your function will be given lower and upper integer bounds. Your task is to return a vector containing the first five prime numbers in that range that contain the number five. But, if you can't find at least five such numbers, the function should give up and return -1.

For example, for n_min = 60 and n_max = 1000, the set of prime numbers is:

 p = [61,67,71,73,79, ... 149,151,157,163, ... 241,251,257,263, ... 349,353,359,367, ... 983,991,997]

This set contains at least five numbers that c...
Matlab cody problem 2736 . Pernicious Anniversary Problem
Matlab cody problem 2736 - Pernicious Anniversary Problem . Code is ready and checked just copy and paste into the test suite and enjoy the points!

Since Cody is 5 years old, it's pernicious. A Pernicious number is an integer whose population count is a prime. Check if the given number is pernicious.
- Package deal
- Answers
- • 2 pages •
Matlab cody problem 2736 - Pernicious Anniversary Problem . Code is ready and checked just copy and paste into the test suite and enjoy the points!

Since Cody is 5 years old, it's pernicious. A Pernicious number is an integer whose population count is a prime. Check if the given number is pernicious.