Skip to main content
Commonmark migration
Source Link

#MATL, 18 17 bytes

MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

YB      % input number. Convert to binary string
T       % push true value
y       % duplicate binary string and push it at the top of the stack
d~      % true for each value that equals the previous one
T       % push true value
hh      % concatenate: true, indices, true
f       % find indices of true values
d       % consecutive differences: lenghts of alternating sequences
1wY{    % split binary string according to those lengths
ZB      % convert each substring into decimal number

#MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

YB      % input number. Convert to binary string
T       % push true value
y       % duplicate binary string and push it at the top of the stack
d~      % true for each value that equals the previous one
T       % push true value
hh      % concatenate: true, indices, true
f       % find indices of true values
d       % consecutive differences: lenghts of alternating sequences
1wY{    % split binary string according to those lengths
ZB      % convert each substring into decimal number

MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

YB      % input number. Convert to binary string
T       % push true value
y       % duplicate binary string and push it at the top of the stack
d~      % true for each value that equals the previous one
T       % push true value
hh      % concatenate: true, indices, true
f       % find indices of true values
d       % consecutive differences: lenghts of alternating sequences
1wY{    % split binary string according to those lengths
ZB      % convert each substring into decimal number
added 537 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

#MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

YB      % input number. Convert to binary string
T       % push true value
y       % duplicate binary string and push it at the top of the stack
d~      % true for each value that equals the previous one
T       % push true value
hh      % concatenate: true, indices, true
f       % find indices of true values
d       % consecutive differences: lenghts of alternating sequences
1wY{    % split binary string according to those lengths
ZB      % convert each substring into decimal number

#MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

#MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

YB      % input number. Convert to binary string
T       % push true value
y       % duplicate binary string and push it at the top of the stack
d~      % true for each value that equals the previous one
T       % push true value
hh      % concatenate: true, indices, true
f       % find indices of true values
d       % consecutive differences: lenghts of alternating sequences
1wY{    % split binary string according to those lengths
ZB      % convert each substring into decimal number
added 8 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

#MATL, 1818 17 bytes

YBtd~Thf0whd1wYYBTyd~Thhfd1wY{ZB

Try it online!Try it online!

#MATL, 18 bytes

YBtd~Thf0whd1wY{ZB

Try it online!

#MATL, 18 17 bytes

YBTyd~Thhfd1wY{ZB

Try it online!

Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading