File Exchange

image thumbnail

Find biggest prime number which is near input number.

version 1.0.0.0 (892 Bytes) by Hoai Tran Quoc
Find biggest prime number near the given number

1 Download

Updated 07 Oct 2016

View License

Find the biggest prime number near the specific number (>= 2).
Example:
>> max_prime_no(1e9)
ans =
999999937

Cite As

Hoai Tran Quoc (2021). Find biggest prime number which is near input number. (https://www.mathworks.com/matlabcentral/fileexchange/59549-find-biggest-prime-number-which-is-near-input-number), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

nisansf

alexander

input 10 returns 7 which is the nearest to 10 on the low side. the nearest prime to 10 is actually 11.

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!