Skip to main content
added 19 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Edit (June 12, 2016)

The code can now be tried onlinetried online. Commas need to be replaced by spaces, and 6L by 4L, to conform to changes in the language.

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Edit (June 12, 2016)

The code can now be tried online. Commas need to be replaced by spaces to conform to changes in the language.

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Edit (June 12, 2016)

The code can now be tried online. Commas need to be replaced by spaces, and 6L by 4L, to conform to changes in the language.

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'
added 229 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Edit (June 12, 2016)

The code can now be tried online. Commas need to be replaced by spaces to conform to changes in the language.

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Edit (June 12, 2016)

The code can now be tried online. Commas need to be replaced by spaces to conform to changes in the language.

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'
added 180 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'

#MATL, 21 bytes

35,5Y216,j6L)!16ZA-)h

This uses release 6.0.0 of the language/compiler, which is earlier than the challenge.

Input digits should be uppercase.

###Example

This has been executed on Octave:

>> matl
 > 35,5Y216,j6L)!16ZA-)h
 >
> #FFAA20
#0055DF

###Explanation

35,             % number literal: ASCII code of '#'
5Y2             % '0123456789ABCDEF'
16,             % number literal
j               % input string
6L)             % remove first element
!               % transpose
16ZA            % convert from hex to dec
-               % subtract from 16
)               % index into '0123456789ABCDEF' to convert back to hex
h               % prepend 35, which gets automatically converted into '#'
added 27 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading