Skip to main content
added 16 characters in body
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl 5 -p, 7171 69 bytes

uses no separator. The negative and positive parts are in "roman order" (largest digit first)

#!/usr/bin/perl -p
$n=$_}{$_=21;ss/@{[$n++%3]}\K/y]/,$n/=3,y/?-y]/>-x]/while--$=;yfor($_=21)x31;y/>?@12/139/d

Try it online!Try it online!

Perl 5 -p, 71 bytes

uses no separator. The negative and positive parts are in "roman order" (largest digit first)

#!/usr/bin/perl -p
$n=$_}{$_=21;s/@{[$n++%3]}\K/y/,$n/=3,y/?-y/>-x/while--$=;y/>?@12/139/d

Try it online!

Perl 5 -p, 71 69 bytes

uses no separator. The negative and positive parts are in "roman order" (largest digit first)

#!/usr/bin/perl -p
$n=$_}{s/@{[$n++%3]}\K/]/,$n/=3,y/?-]/>-]/for($_=21)x31;y/>?@12/139/d

Try it online!

Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl 5 -p, 71 bytes

uses no separator. The negative and positive parts are in "roman order" (largest digit first)

#!/usr/bin/perl -p
$n=$_}{$_=21;s/@{[$n++%3]}\K/y/,$n/=3,y/?-y/>-x/while--$=;y/>?@12/139/d

Try it online!