partitions

partitions(n) returns the nth partition number, up to Matlab's largest integer capabilities.

You are now following this Submission

partitions(n) returns the nth partition number, up to Matlab's largest integer capabilities.

examples: partitions(0) returns 1 and partitions(200) returns 3972999029388.

The algorithm used is due to Euler and is delineated in a video by Mathologer (the inspiration for this code).

Cite As

Douglas Brunson (2026). partitions (https://in.mathworks.com/matlabcentral/fileexchange/86277-partitions), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.1

credit attributed to Mathologer

1.0.0