[Question]
  [
*Too bad! I had such a beautiful equation, but I lost all my `=+-*`, so there is nothing left but a chain of digits, looking like a number: `7512`. But was it `7+5=12` or `7-5=1*2` or `7=5*1+2` or `7=5+1*2`? Or are there even more valid possibilities?*
Your task: **For a given positive integer number, return the number of true equations containing the digits of that number in the given order, using plus and minus and multiplication operators.**
* dot-before-dash calculation is used, so 1+2\*3 is 7, not 9
* plus and minus are only allowed as operators, not as (prefix) sign, so neither negative numbers in the equation nor superfluous plus padding
* no division to keep rules simple
* input numbers are integers ranging from `0` to `999999`
* no leading zeroes, neither in input, nor in equations
* operators are allowed to appear several times, but of course only exactly one `=`
* a single digit as input leads to `0` as output, because you can't do any equation with it
* the smallest number to return `1` is `11` (equation is `1=1`)
* don't underestimate the possibilities for higher numbers like `1111` (`10`possible equations: `11=11 1*1=1*1 1+1=1+1 1-1=1-1 1=1*1*1 1=1-1+1 1=1+1-1 1*1*1=1 1-1+1=1 1+1-1=1`
* you are free to use anything from brute force to intelligent algorithms, execution time is irrelevant, just *don't use many bytes of code*, because we are golfing
Check your code with these examples:
```
7      --> 0
42     --> 0
77     --> 1
101    --> 3
121    --> 1
1001   --> 12
1111   --> 10
7512   --> 5
12345  --> 5
110000 --> 203
902180 --> 37
```
  
[Answer]
# GNU `sed -E`, ~~214 200 181 171~~ 169 bytes
For some not-so-obvious reason, I decided to solve this by myself in `sed`, misusing the shell for expression evaluation with the `e` flag of the GNU version of the tool:
```
G:1;s/(\S*[0-9])([0-9]\S*\n)/\1_\2\1==\2\1+\2\1-\2\1*\2/;t1;s/_//g;:2;s/(\n|^)[^=]+\n/\n/;s/\S*=\S+=\S*//;t2;s/\S*/+$((&))/g;s/\S*[ =*+-]0[0-9]\S*//g;s/.*/echo $((&))/e
```
**[Try it online!](https://tio.run/##NU27DsIwDPyVDgjloeAmWxtlRHxAx7jtAFVhSSqlbHw7wQkg2Wfd2XdOy02t4ZnzxfbaJmA4CN@qbuSsDqIYOKCe0aB2rqAsoAoINGD34psBVtubmhBeE/eTGyUGoCKNUhwOkloAGcxXAnlg7Mg5OSv3jRNSje3/MdTFScByvcfmd7vk3L3jtj9iSFmdPw "sed – Try It Online")**
* `G` appends the (empty) hold space, so it adds a newline to the end, which is used as a separator
* `:1;s/(\S*[0-9])([0-9]\S*\n)/\1_\2\1==\2\1+\2\1-\2\1*\2/;t1` loops to add operators or `==` between each pair of digits, marking already considered pairs by `_`
* `s/_//g` removes the `_` markers
* `:2;s/(\n|^)[^=]+\n/\n/;s/\S*=\S+=\S*//;t2` removes items without `==` or with more than one `==`
* `s/\S*/+$((&))/g` turns each equation in to an arithmetic expansion `$(())`
* `s/\S*[ =*+-]0[0-9]\S*//g` is needed to remove all equations including a leading zero
* `s/.*/echo $((&))/e` finally evaluates the whole rubbish
[Answer]
# JavaScript (ES6), 107 bytes
*-26 bytes (!) thanks to [@tsh](https://codegolf.stackexchange.com/users/44718/tsh)*
```
f=([c,...a],s,g=o=>f(a,[s]+c+o))=>c?g``+g`==`+g`+`+g`-`+g`*`:/^(?!.*\D0\d)[^=]*==[^=]*\d$/.test(s)&&eval(s)
```
[Try it online!](https://tio.run/##fc5tC4IwEAfw930KGxGb2txWYgWXb/oWPuCYDxTSoklf3zLCRKt78b@DH8fdWd6lUbfTtVlddF60bQk4Ui6lVCaucSvQcCixdCOTOMrRhMBBhVWWOVUG0KXTxaoLO9t7KQ7n1I6PLM5JlEJiA7xanC882hSmwYYsl8Vd1s@hVfpidF3QWle4xChAVleEWJ5nsdlINwL90SAYKB8rZxz1up6oGOiX3dfyW8WEn/Xh6V8@Fz3708vrjY9@6Y4JvmXo/XXQPgA "JavaScript (Node.js) – Try It Online")
### How?
We recursively build all possible expressions obtained by adding `""`, `"=="`, `"+"`, `"-"` or `"*"` after each character.
For each expression, we test whether it matches:
```
//         .--------------------> no number may start with '0'
//         |      .-------------> left part
//         |      |   .---------> comparison operator
//         |      |   |  .------> right part (except the last character)
//         |      |   |  |   .--> we must end with a digit
//    _____|___  _|_  | _|_  |
//   /         \/   \/\/   \/\
   /^(?!.*\D0\d)[^=]*==[^=]*\d$/
```
If it does, we can safely `eval()`'uate it and increment the final result if it's truthy.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 28 bytes
```
øṖ'⌊=A;ƛṄfð`+*-,`VΠEƛk-İ⁼]f∑
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m720rLIiMWdptJKjUuyCpaUlaboWN3UO73i4c5r6o54uW0frY7Mf7mxJO7whQVtLVych7NwC12Ozs3WPbHjUuCc27VHHxCXFScnFMJ360UrqCeamhkYJ6ko6QKahgaEhjGkIZ1oaGBlaGAA5MBsB) Semi-port of [Jonathan Allan's Jelly answer](https://codegolf.stackexchange.com/a/265130/100664), but much clunkier. The `A` flag runs testcases.
```
øṖ                           # Partitions
  '   ;                      # Where 
     A                       # All substrings
    =                        # Are equivalent under
   ⌊                         # Cast to integer
       ƛ                 ]   # For each partition
                  Π          # Cartesian product of
        Ṅf                   # Join with spaces and flattening
          ð`+*-,`V           # Then replacing spaces with "+*-,"
                  Π          # Resulting in all combinations of the operators and strings
                   E         # Evaluate as Python
                    ƛ    ]   # Map each to
                        ⁼    # Whether it remains the same under
                     k-İ     # [x[-1], x[1]] - ensures it is a 2-item list with both items the same
                          f∑ # Flatten and count truthy values
```
[Answer]
# [Python](https://www.python.org), 178 bytes
*-2 bytes, thanks to corvus\_192*
```
lambda s:len({*filter(eval,q(s,"=="))})
q=lambda s,c:[l+c+r for i in range(1,len(s))for l in e(s[:i])for r in e(s[i:])]
e=lambda s:[s]*(s==str(int(s)))+q(s,"+")+q(s,"-")+q(s,"*")
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XY5BDsIgFET3PQVhBW1NStVUSThJ7aIqKAmiApoY40ncNDF6AG_jbSxqTejf8Of9yTDXx-7k1lvd3ASb3Q9ODCavp6o382UNLFVco3MspHLcIH6sVbpHNoWMQYwvONqzzpkuaKmSRWKA2BoggdTA1HrFEUl9hsXYc-U5R7aksvoA0wFJK1xF_J9HS1vFyDJmnUFSO5-Ak8_nCfwtg26JIf41v-2MNwsEi7Zh9FejPJBFeCUZCXXe01nf0E4YOCZ5L2I4GgdkmuVkkrXoW7Vpvu8b)
*Takes the string representation of the number as input*
Generates all possible equations, uses `eval` to compare the results
The `*(s==str(int(s)))` part prevents leading zeros
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~35 34 32~~ 31 bytes
-3 thanks to [Unrelated String](https://codegolf.stackexchange.com/users/85334/unrelated-string)! (Filtering leading zero decimals with `ḌVÐṀ` rather than the somewhat clunky `ḌD$ƑƇḌ`. Also `Ṛṁ2ƊƑ` -> `.ị$Ƒ`)
```
DŒṖḌVÐṀżFŒV.ị$ƑʋⱮL’“*+,-”ṗƲ$€FS
```
A monadic Link that accepts a positive integer and yields the count.
**[Try it online!](https://tio.run/##y0rNyan8/9/l6KSHO6c93NETdnjCw50NR/e4HZ0Upvdwd7fKsYmnuh9tXOfzqGHmo4Y5Wto6uo8a5j7cOf3YJpVHTWvcgv/rHG7XdP//P9pcR8HESEfBHEgbGhgCCSMQYQBmAgFQxtTQCCRsbGKqo2BpYGRoYRALAA "Jelly – Try It Online")**
### How?
```
DŒṖḌVÐṀżFŒV.ị$ƑʋⱮL’“*+,-”ṗƲ$€FS - Link: positive integer, N
D                               - get a list of N's digits
 ŒṖ                             - all partitions of that list
   Ḍ                            - convert each part of each from base ten
                                  : e.g. [0,7,2] -> 72
     ÐṀ                         - keep those maximal under:
    V                           -   evaluate as Jelly code (e.g. [4,72,1]-> 4721)
                                  : i.e. those that had no leading zero digit
                            €   - for each DecimalisedPartition:
                           $    -   last two links as a monad:
                          Ʋ     -     last four links as a monad:
                 L              -       length
                  ’             -       decrement
                   “*+,-”       -       "*+,-"
                         ṗ      -       Cartesian power
                Ɱ               -     map across these operator lists with:
               ʋ                -       last four links as a dyad:
       ż                        -         {DecimalisedPartition} zip {Operators}
        F                       -         flatten
         ŒV                     -         evaluate as Python code
              Ƒ                 -         is {X=that} invariant under?:
             $                  -           last two links as a monad:
           .                    -             0.5
            ị                   -             index into {X} -> [last(X), first(X)]
                                          : i.e. is exactly two equal values?
                             F  - flatten
                              S - sum
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 61 bytes
```
⊞υωＦ⮌θ≔ΣＥυ⁺ι⁺⎇∧κ∨⁼κ0∨⌕κ0⁻§κ¹ＩΣ§κ¹⟦+¦-¦*ω==⟧⟦ω⟧κυＩＬΦυ∧⁼²№ι=ＵＶι
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VVCxTsMwEBUrH4EsTxdIpIQJqeoQoSIhUREBW5XBpG5j1TjU9iX0W1g6FME38TWc4yx4uJPfu3fv2Z8_TSts0wl9PH6h32Q3v2cXFboWMGVDMjvfdJbBk-yldRL2ScJK59TWwDO-wVK8h7FKowM19RdpjbAHKM0adil7tLDYo9AuXHjOkxG6U5GNwFIZEpb-3qzlR4ALAm-F86PJPzyelK34FSd5FsollYH6fM5rYoaa-F0cQ3pAZZXxMK57kGbrW3LXXtqQPISc4l2TZYc0qcIqHtTVwbedWfRCo_ASVDSfndxr46bP-l7xrNe8PhV5XkToDw) Link is to verbose version of code. Explanation:
```
⊞υω
```
Start with an empty expression.
```
Ｆ⮌θ
```
Loop over the digits in reverse order.
```
≔ΣＥυ⁺ι⁺⎇∧κ∨⁼κ0∨⌕κ0⁻§κ¹ＩΣ§κ¹⟦+¦-¦*ω==⟧⟦ω⟧κυ
```
For each expression so far, prefix this digit, but if the expression is not empty, and it either does not being with `0` or the `0` is not part of a larger number, then also optionally insert an operator.
```
ＩΣＥΦυ⁼²№ι=ＵＶι
```
For each expression that contains exactly one equality operator, evaluate that as python, and output the the number of expressions for which everything is true.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 33 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
.œʒïJQ}ε©…-+*„==ªsg<ãε®s.ιJ]˜.EáO
```
[Try it online](https://tio.run/##AT8AwP9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkXDoU///zEwMDE) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfaVLqNJ/vaOTT006vN4rIrD23NZDKx81LNPV1nrUMM/W9tCq4nSbw4uBouuK9c7t9Io9PUfP9fBC//9KemE6/6PNdUyMdMzNdQwNDHUMjYDYAMQAAh1zU0MjoJCxiamOpYGRoYVBLAA).
**Explanation:**
Step 1: Get all partitions of the input-integer, and remove all partitions that contain parts with leading 0s:
```
.œ         # Get all partitions of the (implicit) input-integer
  ʒ        # Filter the list of lists of parts by:
   ï       #  Cast each part to an integer, removing leading 0s
    J      #  Join all parts back together
     Q     #  Check whether it's equal to the (implicit) input-integer
  }        # Close the filter
```
[Try just step 1 online.](https://tio.run/##yy9OTMpM/f9f7@jkU5MOr/cKrP3/39DAwBAA)
Step 2: Create all possible equations of each partition using `-`,`+`,`*`,`==` delimiters:
```
ε          # Map over each remaining partition:
 ©         #  Store the current partition in variable `®` (without popping)
  …-+*     #  Push string "-+*"
      „==ª #  Convert it to a list of characters, and append "==": ["-","+","*","=="]
  s        #  Swap so the partition is at the top again
   g       #  Pop and push its length
    <      #  Decrease it by 1
     ã     #  Get the cartesian power of the ["-","+","*","=="] and this length-1
  ε        #  Inner map each list of operators by:
   ®       #   Push partition `®`
    s      #   Swap so the current list of operators is at the top
     .ι    #   Interleave the two lists
       J   #   And then join them together to a single string
]          # Close the nested maps
 ˜         # Flatten the list of list of equation-strings
```
[Try the first two steps online.](https://tio.run/##AToAxf9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcuc//8xMDAx)
Step 3: Evaluate each equation-string as Elixir code: `.E`.  
[Try the first three steps online.](https://tio.run/##ATwAw/9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkX//zEwMDE)
Step 4: Count the amount of `"true"` values, which under the hood are all `1` (05AB1E's truthy value), making it difficult to find a correct and short way of distinguishing `"true"` from actual `1`s. To give some examples of why this works so weird:
1. Counting the amount of `"true"` in the list results in 0: [try it online](https://tio.run/##AUQAu/9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkUidHJ1ZSLCov//MTAwMQ);
2. Trying to convert it to a flattened list of characters results in an error, since it cannot convert the `"false"` / `"true"` items: [try it online](https://tio.run/##AT0Awv9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkVT//8xMDAx);
3. Filtering on 05AB1E-truthy values will keep both the `1` and `"true"`: [try it online](https://tio.run/##AT8AwP9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkXKkn3//zEwMDE) or [try it online](https://tio.run/##AT8AwP9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkVEw4///zEwMDE);
4. Sorting (after the truthy filter) does work correct, although an additional group-by not: [try it online](https://tio.run/##AUUAuv9vc2FiaWX//y7Fk8qSw69KUX3OtcKp4oCmLSsq4oCePT3CqnNnPMOjzrXCrnMuzrlKXcucLkXKkn17PQrOsyz//zEwMDE);
5. etc.
Eventually I noticed the `þ` (keep all digits/numbers) and `á` (keep all letters/words) would correctly distinguish between the two, so I've used that to finish my program that utilizes Elixir-equations and evals:
```
á          # Keep all letters/words (which will only keep all "false" and "true")
 O         # Sum this list together, since they're 0 and 1 under the hood
           # (after which this count of "true" items is output implicitly as result)
```
[Answer]
# [Python](https://www.python.org), 255 bytes
```
lambda s:len({q for r in range(len(s)+1)for o in combinations("+-*"*len(s),r)for p in permutations([*s,"==",*o])if match(f"{n}=={n}$",q:="".join(p))and s==sub("\D","",q)and eval(q)})
m="(0|[1-9]\d*)"
n=f"{m}(\D{m})*"
from itertools import*
from re import*
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TdBBTgMhFIDh_Zzi5dUFUGo6aqM2YddbdLpgLFjMAFNgNKb2JG6aGL2Tp9GZUmM3EL788BLev9rXtPHu8KFF9dklPbn7_mmkrdcS4rxRjuy2oH2AAMZBkO5RkUEjHZd0cD_4g7e1cTIZ7yLB8YQhyxEPx6gdolYF26VTtGSRoxDImV9Ro8HK9LAhGnduL0S_XCDfzgXi5ZM3jrSUSreGKETsaoLVAjn2wRHVs2zIlu5pYQWS6duynNyvqjWjWDjRP2j3pFr0K2VY6OAtmKRC8r6JYGzrQ2KZg_o7n77hpQ3GJTLloAneIqXFOdxc_UuZk7Pm-ijltBxolG2Wq1k53IQRJGNVBN8lDnWX-vmpCy7CLI8_HPL-Cw)
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~117~~ 113 bytes
Takes a string as input. Creates every possible combination of operators and counts which ones have no leading zeroes and `eval` to `true`.
This is probably the only time in Ruby golfing when `do`/`end` will ever be cheaper than the curly brace syntax, since that allows `rescue SyntaxError` without adding a `begin` block like it normally would require. (Inline `rescue` doesn't catch SyntaxError so the longer syntax is needed.)
-4 from Dingus.
```
->s{[p].product(*[%W"#{} == + - *"]*s.size).count do
!p==eval(e=_1.zip(s.chars)*'')&&/0\d/!~e
rescue$!.class;end}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=LY1daoNAFIXf7yquP03U4GTGJJhSptvogxEx45gINk4dp6URu5G-BNouKrvplPTAgY8DH-fzuzf798tXzXc_Zqjj7fUlftRjpnKi-q4yYgii7O7J9cYJOccFxhi5eaSJbs4yJKIzpwGrDhzFuXwt20DygpFzowJNxLHsdRjN5-FstqS7aul8SOilFkb6DhFtqfWDPFXT__Hq7di0Eg9y0IB-YfXuWTmAygwa3Trz_CJHjt5YZ5YmF6x7Uy_XRQrrBNIUGGXAElv6BzaQblhip9V6A_c0YVt6c34B)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 96 bytes
```
f=([c,...a],s='',g=t=>f(a,s+t))=>/\b0\d/.test(s+=c)?0:a+a?g`+`+g`-`+g`*`+g``+g`===`:eval(s)===!0
```
[Try it online!](https://tio.run/##fc5tC4IwEAfw930K25u2ZnObiSWcfpAMXD5RSEYbfn3TEBOtDu44@HHc/6YapdPn9WF29zrL27YAfEptxpg62xo2G7sEA2GBla2pIQRCJ77wOHOYybXBmkJKIh4oqqIyoQktk10/tv3oGwCSIG9UhTXp9jVv0/qu6ypnVV3iAiMfWX0RYjmOxVcz3Uv0R31/omKuggs0qrtQOdEvt@/jQeWCu/rwMpcn5Mje8rO799AvPXIpDhwNqf32BQ "JavaScript (Node.js) – Try It Online")
Unlike Arnauld who tests if exactly one `==` exist, I use `===`:
```
1             => 1
1===1         => true
1===1===1     => false
1===1===1===1 => false
```
so if it results in `true` it's an equation
]