Generate a list of composite numbers - MATLAB Cody - MATLAB Central

Problem 46600. Generate a list of composite numbers

Difficulty:Rate
Prime numbers get a lot of attention in Cody, while composite numbers get relatively little. Right now a search for "prime" on Cody yields 153 problems, while a search for "composite" yields only 27--and only eight of those deal with composite numbers. Let's work toward restoring the balance.
Write a function to list the composite numbers less than or equal to the input number. Remember that 1 is neither prime nor composite.

Solution Stats

69.14% Correct | 30.86% Incorrect
Last Solution submitted on Oct 20, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...
Dive Into Hands-On Learning at MATLAB EXPO 2025 – Register Now!
Get ready to roll up your sleeves at MATLAB EXPO 2025 –...
0

Problem Recent Solvers52

Suggested Problems

More from this Author314

Problem Tags

Community Treasure Hunt

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

Start Hunting!