The lever, the transistor, the vacuum tube and the computer all have something in common. They’re amplifiers, they allow a relatively small change or capability in a domain to have a much larger effect.

Let me give you some examples: The crowbar is an instance of the lever concept, using a crowbar a relatively puny human can lift enormous weights simply by trading the distance that one end of the lever moved by how much the other will move. Push down one end a meter and the other end will go up 5 cm or so, allowing me (and you!) to lift approximately a ton. Similar to the lever are the block-and-tackle, gears, hydraulics and so on.

The transistor and the vacuum tube do the same for electrical signals. A small signal is used to control a larger one, which for instance can be used to create a radio where the very weak signal of the antenna is used to control a much larger signal driving a loud-speaker (there is a bit more to it than that, but that’s the basic element).

Where the lever works on mechanical energy and the transistor or the vacuum tube work with electrical energy the computer operates on information.

A computer allows you to amplify the power of your brain considerably by trading understanding for extreme speed of execution. This allows a person that is not well versed in math for instance to arrive at the correct answers for math problems either by trying a bunch of solutions in a row (called ‘brute forcing’) or by using the computer to figure out a rough approximation to the answer which then leads to the crucial insight required to get an exact answer.

Let me give you an illustration of how this might work. I’m a big fan of Project Euler, it’s a great way to get started with some new language and/or to learn a bit more math. My math skills are always below where I want them to be so for me project Euler serves a double purpose.

One interesting entry is problem #307:

**Chip Defects**

k defects are randomly distributed amongst n integrated-circuit chips produced by a factory (any number of defects may be found on a chip and each defect is independent of the other defects).

Let p(k,n) represent the probability that there is a chip with at least 3 defects. For instance p(3,7) ≈ 0.0204081633.

*Find p(20 000, 1 000 000) and give your answer rounded to 10 decimal places in the form 0.abcdefghij
*

So, how is a math challenged person going to solve that particular problem without complete understanding of either the math or the problem domain?

Simple: use a computer! It will make you appear smarter than you really are by allowing you to trade understanding and math skills for the enormous speed with which it can operate.

The first thing to recognize here after careful reading of the problem is that there are two possible ways to solve it: first by directly plugging in the input variables into a formula that will give an exact answer, the second way, by simulating a chip factory and to work out the ratio as a result of the simulation.

Project Euler problems always helpfully include a ‘toy’ version of the real problem to help you get started and to give you an idea of whether or not you’re on the right track. Here the toy version is the p(3,7) one where you’re supposed to get 0.0204 etc as the answer.

Simulating this problem is not very hard: you need to break down the problem into ‘runs’ of simulations tallying how many chips have 3 or more defects, and then eventually dividing the number of chips with 3 or more defects by the total number of runs. That’s still something that I can figure out, so let’s program that (this is in ‘Erlang’, the language that I’m currently (slowly) learning, the syntax may be a bit off-putting but I’ve included quite a few comments that should help you to read the code):

```
% frequencies returns a list with a tuple per word indicating the
% word and the frequency with which it occured in the input list
frequencies(L) ->
dict:to_list(lists:foldl(fun(Word, Dict) ->
case dict:is_key(Word, Dict) of
true -> dict:store(Word, dict:fetch(Word, Dict)+1, Dict);
false -> dict:store(Word, 1, Dict)
end
end, dict:new(), L)).
% highestfrequency will return the number of times the highest
% frequency element of a list occurs, so for [1, 3, 2, 1, 3, 5]
% it will return 2, the number of times 1 and 3 occured
highestfrequency(L) -> lists:max([B || {_A,B} <- frequencies(L)]).
% returns a list of random elements from a range (non-consuming, so the
% same element can be present multiple times)
randompicks(Npicks, Range) -> [random:uniform(Range) || _ <- lists:seq(1, Npicks)].
% return how frequently the the most frequently occuring circuit id
% was present in a list of randomly assigned defects
simulate(Defects, Circuits) -> highestfrequency(randompicks(Defects, Circuits)).
% onerun does all the runs of the simulation in turn and
% returns the number of chips with 3 or more defects for the batch
onerun(Ndefect, 0, _Defects, _Circuits) -> Ndefect;
onerun(Ndefect, Runs, Defects, Circuits) ->
case simulate(Defects, Circuits) >= 3 of
true -> onerun(Ndefect+1, Runs-1, Defects, Circuits);
false -> onerun(Ndefect, Runs-1, Defects, Circuits)
end.
problem_307(Defects, Circuits) ->
Nruns = 10000, % the number of times we run the simulation
onerun(0, Nruns, Defects, Circuits) / Nruns.
problem_307() -> problem_307(20000,1000000).
```

Running this on the toy problem produced 0.0204, so it seems to be working running it on the real problem produces (after a few minutes) 0.7291, so the actual answer should be close to that.

If we were running a chip factory and we needed an answer 0.7291 is a lot better already than no answer at all but the problem explicitly states to produce the answer to 10 decimal places presumably to avoid people solving the problem through simulation, so this is *not* a solution to the problem as stated.

By increasing the number of ‘runs’ we can obtain higher precision but most likely we’ll never have the solution to 10 decimal places because of the random element involved, so if you’re looking at this post to get the ‘real’ answer to problem 307 then you’ll have to look elsewhere but if you wanted an illustration of how computers really can help you solve problems that you otherwise could not then I hope you found what you were looking for.