Solved


Weighted average
Given two lists of numbers, determine the weighted average as follows Example [1 2 3] and [10 15 20] should result in 33.3...

1 month ago

Solved


Return a list sorted by number of occurrences
Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x. Ties are resolved by a ...

1 month ago

Solved


Generating random matrix with given probability mass function
Inspired by <http://www.mathworks.com/matlabcentral/cody/problems/2356-simulating-the-selection-of-a-state-with-given-probabilit...

1 month ago

Solved


Chain multiplication - 02
Following up on the problem in 55295, you found the number of multiplications needed to multiply two matrices. Now, you are giv...

1 month ago

Solved


Remove the polynomials that have positive real elements of their roots.
The characteristic equation for a dynamic system is a polynomial whose roots indicate its behavior. If any of the roots of the p...

1 month ago

Solved


Too mean-spirited
Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

1 month ago

Solved


DNA N-Gram Distribution
Given a string s and a number n, find the most frequently occurring n-gram in the string, where the n-grams can begin at any poi...

1 month ago

Solved


QWERTY coordinates
Given a lowercase letter or a digit as input, return the row where that letter appears on a standard U.S. QWERTY keyboard and it...

1 month ago

Solved


Break it up! Break it up!
You have N pennies. Write a Matlab script that will reveal how many different ways you can break up those pennies. For example...

1 month ago

Solved


Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

1 month ago

Solved


Calculate the Levenshtein distance between two strings
This problem description is lifted from http://en.wikipedia.org/wiki/Levenshtein_distance. The Levenshtein distance between two...

1 month ago

Solved


Balanced Ternary Numbers: Easy as |, |-, |o
This problem concerns the so-called <http://en.wikipedia.org/wiki/Balanced_ternary balanced ternary> system for representing num...

1 month ago

Solved


List the Beatriz numbers
Write a function to find integers less than or equal to an input value that solve the equation . The function gives the sum o...

1 month ago

Solved


Compute the largest number whose prime factors sum to n
This problem deals with a sequence whose tenth term is 36 because the prime factors of 36 (2, 2, 3, 3) sum to 10. The number 32 ...

1 month ago

Solved


List the cuban primes
The number 61 is a cuban prime because it is prime and the difference two cubes, 64 and 125. Write a function to list the cuba...

1 month ago

Solved


List the Moran numbers
The quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 ...

1 month ago

Solved


Easy Sequences 13: Average Speed of Spaceship
A certain alien spaceship is capable of traveling at extremely high velocities and is able to change speed instantaneously. The ...

1 month ago

Solved


Count the peaceful queens
In a 5x5 chessboard with a queen of one color (white, say) on the perimeter, one can place 12 black queens on the board such tha...

1 month ago

Solved


Compute a determinant
Write a function to compute the determinant of an x matrix with diagonal entries equal to an integer and other entries equal ...

1 month ago

Solved


Compute the Tetris sequence
In the Tetris sequence, which starts with a 1, the next term is the smallest positive integer not already in the sequence that h...

1 month ago

Solved


Compute the largest number with a given integer complexity
Cody Problems 42831 and 42834 ask us to compute integer complexity, the smallest number of 1s needed to construct a number with ...

1 month ago

Solved


Compute the Lagarias Riemann Hypothesis sequence
Write a function that takes an input number and produces a sequence (i.e., all values up to and including the th value) compute...

1 month ago

Solved


Compute the unitary totient of a number
The totient function , the subject of Cody Problems 656 and 50182, gives the number of integers smaller than that are relativel...

1 month ago

Solved


Sum the unitary divisors of a number
Cody Problems 1933 and 46898 deal with , the sum of divisors function. This problem deals with , the sum of unitary divisors fun...

1 month ago

Solved


Count the unitary divisors of a number
Cody Problem 56738 asks for a list of the unitary divisors of a number. For this problem, write a function to count the unitary ...

1 month ago

Solved


List the nth term of Rozhenko’s inventory sequence
Consider a sequence constructed by repeated inventories. A new inventory begins each time a zero is encountered. The first few i...

1 month ago

Solved


List numbers that are not squares
The numbers 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, etc. are not perfect squares. Write a function to list the th term in ...

1 month ago

Solved


Count estrangements
Recently I made a puzzle for my wife that included a cryptogram, which involves an arrangement of the letters A through Z. I use...

1 month ago

Solved


Trap a knight
Consider a knight on an infinite chessboard labeled with numbers spiraling outward. A knight starting on the square labeled 1 ca...

1 month ago

Solved


Flip the parity of digits in a decimal expansion
The number 349 has the decimal expansion . If we change the even digits from positive to negative, then the number becomes 269 (...

1 month ago

Load more