Round up to π - MATLAB Cody - MATLAB Central

Problem 50953. Round up to π

Difficulty:Rate
To commemorate Pi Day (March 14 in the U.S.), compute the nth term in a sequence by starting with n, rounding up to the next multiple of n-1, rounding up to the next multiple of n-2, and so on to rounding up to the next multiple of 1. For example, with n = 8, you would get 14, 18, 20, 20, 21, 22, and—the element in the sequence—f(n) = 22.
Write a function that computes f(n), the nth term in this sequence. Also compute n^2/f(n) and notice its limit as n gets large. For more on this limit, see this page by K.S. Brown.

Solution Stats

65.79% Correct | 34.21% Incorrect
Last Solution submitted on Jan 06, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers22

Suggested Problems

More from this Author298

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page