Feeds
已解决
The Prime Days of Christmas
On the first day of Christmas my true love sent to me partridges in a pear tree. On the second day of Christmas my true love s...
1 day 前
已解决
Conditional transpose II
As in problem 60734, you're given two vectors, x and y, which might be row or a column vectors. Your task is to ensure that y ha...
9 days 前
已解决
Conditional transpose
You're given two vectors of the same length, x and y, which might be row or a column vectors. Your task is to ensure that y has ...
10 days 前
已解决
Remove the diagonal of a square matrix
Some Cody problems ask solvers to remove columns (e.g., CP 7), and others ask solvers to remove rows (e.g., CP 44033). Write a...
17 days 前
已解决
Find the closest geyser prime
My wife and I celebrated our honeymoon and our recent anniversary in Yellowstone and Grand Teton National Parks. After returning...
17 days 前
已解决
Sum the reciprocals of polygonal numbers
As explained in Cody Problem 60571, a polygonal number is the number of dots arranged in the shape of a regular polygon. For exa...
2 months 前
已解决
Complete a 2nd order difference sequence
In Cody Problem 59791 ChrisR asks us to find the integer that completes a randomly sorted geometric sequence with one missing el...
2 months 前
已解决
Pronounce digits
Given a number num, select the first d decimal places and pronounce the digits (in English). The function returns the pronunciat...
2 months 前
已解决
Remove Adjacent Pairs
Given an array of integers where adjacent elements may be identical, your task is to remove these adjacent pairs. If removing on...
2 months 前
已解决
List primes of the form xy+z
Consider three consecutive integers , , and . When is the number prime? For example, if or , then the results are 17 and 37, ...
2 months 前
已解决
Perimeter of a Koch snowflake
A Koch snowflake is an iteratively generated (fractal) shape built out of successively smaller equilateral triangles by followin...
2 months 前
已解决
Find polygonal numbers that are Blum integers
A polygonal number is the number of dots arranged in the shape of a regular polygon. For example, 15 is a triangular number beca...
3 months 前
已解决
Determine whether a number is a Blum integer
A Blum integer is a semiprime—that is, the product of two distinct primes—whose factors have the form for some integer . The nu...
3 months 前
已解决
Jigsaw 001: Intro 2x2 square. Pieces 128x128
This challenge is to re-assemble camerman.tif in grayscale from four 128x128 pieces into a 256x256 image. The pointer layou...
3 months 前
已解决
Compute the totient summatory function
Cody Problem 656 deals with the totient function, denoted by which counts the numbers less than that are relatively prime to ....
3 months 前
已解决
Compute the number of squares a knight can reach after n moves
Several Cody problems involve knights from chess. They have asked players to find a knight’s tour in a matrix (CP 96), determine...
3 months 前
已解决
Compute Farey sequences
Problem statement The Farey sequence of order consists of fractions between 0 and 1 expressed in reduced form in increasing or...
3 months 前
已解决
Secret Message and Acrostic
One of the simplest ways to hide a message involves utilizing uppercase letters. Given a text, collect all uppercase letters in...
3 months 前
已解决
Reversing Maximal Ascending Subsequences
Create and return a new array that contains the same elements as the input array, but with the elements within each strictly inc...
3 months 前
已解决
Largest Rectangle Area in a Histogram
Given a histogram represented by an array of integers, e.g., [2, 1, 4, 5, 1, 3, 3] : find the maximum area of a rectangle tha...
3 months 前
已解决
Calculating the Union Area of Overlapping Rectangles
Calculate the area covered by a union of multiple rectangles. Each rectangle is represented by 4 integers: the first two integer...
3 months 前
已解决
Project Euler: Problem 18, Maximum path sum I
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bott...
3 months 前
已解决
Alert a city about a spill
Problem statement Cody Problem 54750 involved determining the length of a stream affected by a spill of a contaminant. Any muni...
3 months 前
已解决
Next Lower Power of B
Given a number _n_ and a base _B_ greater than 1, return the lowest integer power of _B_ that is less than or equal to _n_. E...
3 months 前
已解决
Compute a sequence with the whyphi sieve
A few problems on Cody involve sieving. For example, Cody Problem 45367 involves the famous Sieve of Eratosthenes. CP 50811uses ...
4 months 前
已解决
Compute the area of a Q
A figure resembling a Q (as in “quadrature”) is constructed in the following way: A right triangle is drawn with the left vertex...
4 months 前
已解决
List the smallest numbers with n distinct prime factors
The author of a book I am reading asked a mathematician what it feels like to be sixty. He wrote He replied, “Sixty, sandwiched...
4 months 前
已解决
Find primes and integers that solve an equation
Write a function to find all primes and non-negative integers that solve the equation where is an integer. If there are no...
4 months 前
已解决
Determine whether a property description closes
The arrival of summer makes think back to the summers I spent working for my father’s engineering firm. For the first several s...
4 months 前
已解决
Classify numbers as abundant, deficient, or perfect
A number is perfect if the sum of its proper divisors (i.e., divisors excluding the number itself) is equal to itself. For examp...
4 months 前