Skip to main content
added 96 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249

MATL, 1212 11 bytes

-1 byte thanks to the master himself:)

60:B"@fQ6eq]B"@fQ6eq

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "      ]   % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       Q      % increment everything
        6e    % reshape and pad with a zero at the end
          q   % decrement (reverts the increment and makes a -1 out of the zero
              % close loop (]) implicitly
              % display the entries implicitly

Try it online!Try it online!

MATL, 12 bytes

60:B"@fQ6eq]

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "      ]  % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       Q      % increment everything
        6e    % reshape and pad with a zero at the end
          q   % decrement (reverts the increment and makes a -1 out of the zero
              % display the entries implicitly

Try it online!

MATL, 12 11 bytes

-1 byte thanks to the master himself:)

60:B"@fQ6eq

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "         % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       Q      % increment everything
        6e    % reshape and pad with a zero at the end
          q   % decrement (reverts the increment and makes a -1 out of the zero
              % close loop (]) implicitly
              % display the entries implicitly

Try it online!

Post Undeleted by flawr
added 175 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249

MATL, 1012 bytes

60:B"@f&D]B"@fQ6eq]

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "    ]  ]  % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       &DQ      % convertincrement toeverything
        6e    % reshape and pad with a stringzero representationat the end
          q   % decrement (reverts the increment and makes a -1 out of the zero
              % display themthe entries implicitly

Try it online!Try it online!

MATL, 10 bytes

60:B"@f&D]

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "    ]    % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       &D     % convert to a string representation and display them

Try it online!

MATL, 12 bytes

60:B"@fQ6eq]

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "      ]  % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       Q      % increment everything
        6e    % reshape and pad with a zero at the end
          q   % decrement (reverts the increment and makes a -1 out of the zero
              % display the entries implicitly

Try it online!

Post Deleted by flawr
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249

MATL, 10 bytes

60:B"@f&D]

Explanation:

60:           % create a vector [1,2,3,...,60]
   B          % convert to binary matrix (each row corresponds to one number)
    "    ]    % loop over the columns and execute following commands:
     @f       % "find" all the nonzero entries and list their indices
       &D     % convert to a string representation and display them

Try it online!