9

2

Write a program or function that takes input: all resistors available and a resistance value and outputs a truthy value of whether or not it is possible to get the resistance by using those resistors.

**Rules:**

Any format for input will do.

There will be at least 1 available resistor and your program should output for at least 10 available resistors.

Resistance of all available resistors and the required resistance will be positive integers.

For available resistors if a fractional value is also possible, the required resistance may be the approximated value.(See example)

Output should be any 2 unique values for Possible and Not possible.

The resistors may be connected in any manner.

*Series* Resistance:
For n resistances in series: Result=R1+R2+R3+....Rn

*Parallel* Resistance:
For n resistances in parallel: Result=1/(1/R1+1/R2+1/R3+....+1/Rn)

The circuit may not require all the resistors to get the required resistance (output True if that is the case).

**Winner:**

This is code-golf so shortest-code wins.

**Examples:**

```
R List
110 220,220 -> True
440 220,220 -> True
550 400,300 -> False
3000 1000,3000 -> True
750 1000,3000 -> True
333 1000,1000,1000 -> True (1000||1000||1000=333.333)
667 1000,1000,1000 -> True ((1000+1000)||1000=666.6666)
8000 1000,1000,7000 -> True
190 100,200,333,344,221 -> True
193 105,200,333,344,221 -> True
400 200,100 -> False
```

Explanation for the last two examples: https://physics.stackexchange.com/questions/22252/resistor-circuit-that-isnt-parallel-or-series

What bout

`3 3 1`

,`3 3 2`

? – l4m2 – 2018-10-29T08:05:27.0471.5 is rounded to 2, required resistance will not be given 0(added it to the question), 3 3 will be true – Vedant Kandoi – 2018-10-29T08:08:30.170

Nice challenge, but I deal enough with EE as it is... – None – 2018-10-29T21:10:35.130

I guess Machematica win? – l4m2 – 2018-10-31T10:13:47.407

Would you mind adjusting your test cases to more clearly separate the list of resistors from the target resistance for each example? – Kamil Drakari – 2018-10-31T13:57:47.807

Also, suggested test case:

`[10,200], 400 -> False`

assuming you don't want to let answers use the same resistor multiple times. – Kamil Drakari – 2018-10-31T15:20:23.1372This problem is harder than the description makes it sound because general resistor circuits can't be broken down recursively into series and parallel parts, in more complicated ways than the last two test cases. 10 resistors should be easily enough to make such examples. I suspect that none of the currently posted answers work in general, and a correct answer needs to have matrix inversion in some form. – xnor – 2018-10-31T17:04:36.003

If you intend to allow arbitrary circuits, you probably need a description of Kirchhoff's laws. – Nitrodon – 2018-10-31T17:34:02.153

Rounding <0.5 down I assume, so three 1 Ohm resistors in parallel results in a superconductor? – Penguino – 2018-10-31T21:10:25.127

@Penguino Technically yes, but the required resistance will never be 0 in the problem. – Vedant Kandoi – 2018-11-01T05:47:44.270