Skip to main content
added 51 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 35 28 2727 26 bytes

Edit: -1 byte thanks to Dom Hastings, and -1 byte thanks to caird coinheringaahing

!grepl("ro|^p|c""ro|p|c",scan(,''))

Try it online!Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p''p', and 'cyan' contains 'c'.

R, 35 28 27 bytes

Edit: -1 byte thanks to Dom Hastings

!grepl("ro|^p|c",scan(,''))

Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p', and 'cyan' contains 'c'.

R, 35 28 27 26 bytes

Edit: -1 byte thanks to Dom Hastings, and -1 byte thanks to caird coinheringaahing

!grepl("ro|p|c",scan(,''))

Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain 'p', and 'cyan' contains 'c'.

added 50 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 35 2828 27 bytes

Edit: -1 byte thanks to Dom Hastings

!grepl("ro|^p|ya""ro|^p|c",scan(,''))

Try it online!Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p', and 'cyan' contains 'ya''c'.

R, 35 28 bytes

!grepl("ro|^p|ya",scan(,''))

Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p', and 'cyan' contains 'ya'.

R, 35 28 27 bytes

Edit: -1 byte thanks to Dom Hastings

!grepl("ro|^p|c",scan(,''))

Try it online!

Regular-expression check.
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p', and 'cyan' contains 'c'.

deleted 206 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 3535 28 bytes

prod(utf8ToInt!grepl("ro|^p|ya",scan(,'')))%%708<301

Try it online!Try it online!

Takes product of all utf8 character values in the lowercase colour nameRegular-expression check. 
Then, a search for all modulo values that would give a result for all rainbow colours below the result for all non-rainbow colours (or the other way around) found a single 3-digit solution -'maroon' + 'brown' both contain 708'ro', 'purple' and 'pink' both contain (with no 2-digit solutions'^p', and quite a few 4-digit solutions)'cyan' contains 'ya'.

R, 35 bytes

prod(utf8ToInt(scan(,'')))%%708<301

Try it online!

Takes product of all utf8 character values in the lowercase colour name. Then, a search for all modulo values that would give a result for all rainbow colours below the result for all non-rainbow colours (or the other way around) found a single 3-digit solution - 708 (with no 2-digit solutions, and quite a few 4-digit solutions).

R, 35 28 bytes

!grepl("ro|^p|ya",scan(,''))

Try it online!

Regular-expression check. 
'maroon' + 'brown' both contain 'ro', 'purple' and 'pink' both contain '^p', and 'cyan' contains 'ya'.

added 346 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60
Loading
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60
Loading