Skip to main content
deleted 83 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

Wolfram Language (Mathematica), 5252 45 bytes

ToExpression@*StringReplace[{"["->"Prime[",""->"1">"Prime[1"}]

Try it online!Try it online!

Input uses brackets.

Transforms the input into a Mathematica expression that computes the result. We do this simply by replacing [ with Prime[ inserting 1 into every postition except in front of those [Prime[1 we already replaced. This works because concatenation is multiplication in Mathematica.

Wolfram Language (Mathematica), 52 bytes

ToExpression@*StringReplace[{"["->"Prime[",""->"1"}]

Try it online!

Input uses brackets.

Transforms the input into a Mathematica expression that computes the result. We do this by replacing [ with Prime[ inserting 1 into every postition except in front of those [ we already replaced. This works because concatenation is multiplication in Mathematica.

Wolfram Language (Mathematica), 52 45 bytes

ToExpression@*StringReplace[{"["->"Prime[1"}]

Try it online!

Input uses brackets.

Transforms the input into a Mathematica expression that computes the result. We do this simply by replacing [ with Prime[1. This works because concatenation is multiplication in Mathematica.

Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

Wolfram Language (Mathematica), 52 bytes

ToExpression@*StringReplace[{"["->"Prime[",""->"1"}]

Try it online!

Input uses brackets.

Transforms the input into a Mathematica expression that computes the result. We do this by replacing [ with Prime[ inserting 1 into every postition except in front of those [ we already replaced. This works because concatenation is multiplication in Mathematica.