Skip to main content
Space
Source Link
Sanchises
  • 9.5k
  • 1
  • 36
  • 61

MATL, 12 11 bytes

Saved a byte thanks to Luis. I keep forgetting the & is a shortcut for duplicating and transposing.

10:&*11\10\

10:&*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10            % Pust 10 to the stack. Stack: 1
  :           % 1-based range. Stack: [1 2 3 ... 10]
   &          % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
              % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
    *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
     11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
       \      % Modulus. 
        10    % Push 10 to the stack.
          \   % Modulus
              % Implicit display 

Same bytecount:

10t:&*11\w\

MATL, 12 11 bytes

Saved a byte thanks to Luis. I keep forgetting the & is a shortcut for duplicating and transposing.

10:&*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10            % Pust 10 to the stack. Stack: 1
  :           % 1-based range. Stack: [1 2 3 ... 10]
   &          % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
              % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
    *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
     11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
       \      % Modulus. 
        10    % Push 10 to the stack.
          \   % Modulus
              % Implicit display 

Same bytecount:

10t:&*11\w\

MATL, 12 11 bytes

Saved a byte thanks to Luis. I keep forgetting the & is a shortcut for duplicating and transposing.

10:&*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10            % Pust 10 to the stack. Stack: 1
  :           % 1-based range. Stack: [1 2 3 ... 10]
   &          % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
              % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
    *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
     11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
       \      % Modulus. 
        10    % Push 10 to the stack.
          \   % Modulus
              % Implicit display 

Same bytecount:

10t:&*11\w\
added 100 characters in body
Source Link
Stewie Griffin
  • 46.5k
  • 13
  • 132
  • 295

MATL, 1212 11 bytes

10:t!*11\10\

Saved a byte thanks to Luis. I keep forgetting the & is a shortcut for duplicating and transposing.

Try it online! 10:&*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10             % Pust 10 to the stack. Stack: 1
  :            % 1-based range. Stack: [1 2 3 ... 10]
   t &          % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
    !          % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
     *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
      11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
        \      % Modulus. 
         10    % Push 10 to the stack.
           \   % Modulus
               % Implicit display 

Same bytecount:

10t:t!*11\w\&*11\w\

MATL, 12 bytes

10:t!*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10             % Pust 10 to the stack. Stack: 1
  :            % 1-based range. Stack: [1 2 3 ... 10]
   t           % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
    !          % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
     *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
      11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
        \      % Modulus. 
         10    % Push 10 to the stack.
           \   % Modulus
               % Implicit display 

Same bytecount:

10t:t!*11\w\

MATL, 12 11 bytes

Saved a byte thanks to Luis. I keep forgetting the & is a shortcut for duplicating and transposing.

10:&*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10            % Pust 10 to the stack. Stack: 1
  :           % 1-based range. Stack: [1 2 3 ... 10]
   &          % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
              % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
    *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
     11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
       \      % Modulus. 
        10    % Push 10 to the stack.
          \   % Modulus
              % Implicit display 

Same bytecount:

10t:&*11\w\
added 604 characters in body
Source Link
Stewie Griffin
  • 46.5k
  • 13
  • 132
  • 295

MATL, 12 bytes

10:t!*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10             % Pust 10 to the stack. Stack: 1
  :            % 1-based range. Stack: [1 2 3 ... 10]
   t           % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
    !          % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
     *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
      11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
        \      % Modulus. 
         10    % Push 10 to the stack.
           \   % Modulus
               % Implicit display 

Same bytecount:

10t:t!*11\w\

MATL, 12 bytes

10:t!*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Same bytecount:

10t:t!*11\w\

MATL, 12 bytes

10:t!*11\10\

Try it online!

Using @Martin's algorithm: x*y % 11 % 10

Explanation:

10             % Pust 10 to the stack. Stack: 1
  :            % 1-based range. Stack: [1 2 3 ... 10]
   t           % Duplicate range. Stack: [1 2 3 ... 10],[1 2 3 ... 10]
    !          % Transpose last range. Stack [1 2 3 ... 10],[1;2;3 ...10]
     *         % Multiply with broadcasting. Stack: [1 2 3 ...;2 4 6...] (10-by-10 array)
      11       % Push 11 to the stack. Stack [1 2 3 ...;2 4 6 ...], 11
        \      % Modulus. 
         10    % Push 10 to the stack.
           \   % Modulus
               % Implicit display 

Same bytecount:

10t:t!*11\w\
Source Link
Stewie Griffin
  • 46.5k
  • 13
  • 132
  • 295
Loading