Skip to main content
15 of 16
added 114 characters in body
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

Japt v1.4.5, 61 59 92 85 84 70 68 52 bytes

Assumes, as implied by the test cases, that number inputs will always contain multiple digits. Outputs false for invalid string inputs containing at least one valid letter, throws an overflow error for all others.


"OIREASGTBP"
Ñ?UsV e"%v"²_ínuÃe"%V"²_íuu:U¶ßU=nV)©U

Try it (Includes all test cases)


  • 2 4 bytes saved thank to obarakon, who also convinced me to take this up again after I abandoned it earlier. I wish he hadn't!
  • 33 26 25 23(!) 7 bytes sacrificed to check input validity.

\n"..."\nÑ?UsV e"%v"²_ínuÃe"%V"²_íuu:U¶ßU=nV)©U     :Implicit input of integer or string U
\n                                                  :Prevent input value of U from being overridden
  "..."\n                                           :Assign the string "OIREASGTBP" to variable V
         Ñ                                          :Multiply the input by 2
          ?                                         :If truthy (not NaN)
           UsV                                      :  Convert U to a string in custom base V
               e                                    :  Recursively replace all occurrences of
                "%v"                                :    Literal "%v"
                    ²                               :    Duplicate, giving the Japt RegEx class for /[AEIUO][AEIOU]/g
                     _                              :    Pass each match through the following function
                      í                             :      Interleave with
                       n                            :        Literal "n"
                        u                           :        Uppercase
                         Ã                          :  End replace
                          e"%V"²                    :  Recursively replace all occurrences of /[^AEIOU][^AEIOU]/g
                                _                   :  Pass each match through the following function
                                 íuu                :    Interleave with "u" uppercased
                                    :               :Else
                                     U¶             :  Check U for equality with
                                       ß            :    Recursive call with argument
                                        U=          :      Reassign to U
                                          nV        :      Convert U from a base-V string to an integer
                                            )       :    End recursive call
                                             ©U     :  Logical AND with U
Shaggy
  • 43.5k
  • 4
  • 36
  • 94