Problem 110. Make an N-dimensional Multiplication Table

INSTRUCTIONS

This is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to n (input) agains itself in d dimensions.

Note: Inputting d = 0 should return the number 1 and d = 1 should return a column vector with the elements 1 to n.

Example:

Input:

n = 3;
d = 3;

Output:

tt(:,:,1) = [ 1  2  3
              2  4  6
              3  6  9  ];
tt(:,:,2) = [ 2  4  6
              4  8  12
              6  12 18 ];
tt(:,:,3) = [ 3  6  9
              6  12 18
              9  18 27 ];

Solution Stats

35.31% Correct | 64.69% Incorrect
Last Solution submitted on Jul 19, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers127

Suggested Problems

More from this Author55

Community Treasure Hunt

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

Start Hunting!