Japt v1.4.5, 61 59 92 85 84 70 6868 52 bytes
Assumes number inputs will always contain multiple digits. Outputs 0false
for invalid string inputs.
"OIREASGTBP"
"%v"²
Ñ?UsV eW,_ínuÃeWu _íuue"%v"²_ínuÃe"%V"²_íuu:UnV *!Uè["[^{V}NU]"WWu]q|U¶ßU=nV)©U
Try itTry 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(!)23(!) 7 bytes sacrificed to check input validity.
\n"..."\n"%v"²\nÑ"\nÑ?UsV eW,_ínuÃeWu _íuue"%v"²_ínuÃe"%V"²_íuu:UnV *!Uè["[^{V}NU]"WWu]q|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
"%v"² Ñ :"%v" duplicated, givingMultiply the Japt RegEx classinput forby /[AEIOU][AEIOU]/g2
\n ? :AssignIf totruthy variable(not WNaN)
Ñ UsV :Multiply the input by 2
Convert U to a string in custom base ?V
e :If truthy (not NaN)
Recursively replace all occurrences UsVof
"%v" : Convert U to a string in custom baseLiteral V"%v"
eW ² : Recursively replace allDuplicate, occurrencesgiving ofthe W
Japt RegEx class for /[AEIUO][AEIOU]/g
_ : : ByPass passingeach themmatch through the following function
í : : Interleave with
n : : Literal "n"
u : : Uppercase
à : End replace
eWu e"%V"² : Recursively replace all occurrences of W uppercased (RegEx /[^AEIOU][^AEIOU]/g)
_ : ByPass passingeach themmatch through the following function
íuu : Interleave with "u" uppercased
: :Else
UnV U¶ : ConvertCheck U from a base-V string tofor anequality integerwith
*! ß : Multiply by theRecursive logicalcall NOTwith ofargument
Uè U= : Count the occurrencesReassign into U of
[ nV : Construct an array containing
Convert U from a "[^{base-V}NU]" : Literal string with V interpolated,
WWu : W &to uppercasean Winteger
]) : End array
recursive call
q|©U : Logical JoinAND with "|", giving "[^OIREASGTBPNU]|%v%v|%V%V"=/[^OIREASGTBPNU]|[AEIOU][AEIOU]|[^AEIOU][^AEIOU]/gU