Home Puzzles arithmetic – Arrange ten cash in a bowling formation. Fewest pennies to take away so no three pennies that stay have facilities that kind an equilateral triangle?

### arithmetic – Arrange ten cash in a bowling formation. Fewest pennies to take away so no three pennies that stay have facilities that kind an equilateral triangle?

Not a proof, however if you happen to have a look at it as a satisfiability downside, Z3 (SMT solver) will be of some assist right here:

``````from z3 import *

o = Optimize()

# Let's quantity the pins from 0 to 9, it is a lot simpler that means
# A = 0, B = 1, C = 2, D = 3, E = 4, F = 5, G = 6, H = 7, I = 8,
# J = 9
pins = [Bool("%d" % i) for i in range(0, 10)]

# Since there are 15 equilateral triangles, let's
# add them as constraints to be solved
Or(pins[1], pins[3], pins[4]),
Or(pins[2], pins[4], pins[5]),
Or(pins[3], pins[6], pins[7]),
Or(pins[4], pins[7], pins[8]),
Or(pins[5], pins[8], pins[9]),
Or(pins[4], pins[1], pins[2]),
Or(pins[7], pins[3], pins[4]),
Or(pins[8], pins[4], pins[5]),
Or(pins[0], pins[6], pins[9]),
Or(pins[1], pins[6], pins[8]),
Or(pins[2], pins[7], pins[9]),
Or(pins[0], pins[3], pins[5]),
Or(pins[3], pins[2], pins[8]),
Or(pins[5], pins[1], pins[7])))

# reduce takes a variable, so let's cross
# in sum since we won't cross all the listing
o.reduce(Sum(pins))

# examine for satisfiability and
# get the pins to be eliminated if it
# is satisfiable
if o.examine() == sat:
# Get the mannequin
m = o.mannequin()
# Print the variety of pins to be eliminated
print("The variety of pins to be eliminated is %s" % str((m.consider(Sum(pins)))))
# Print the pins to be eliminated
print("The pins to be eliminated are: ", finish="")
for i in vary(0, 10):
if m.consider(pins[i]) == True:
print("%d" % i, finish=" ")
print()
else:
print("The downside is unsatisfiable")

``````

This spits out:

``````The variety of pins to be eliminated is 4
The pins to be eliminated are: 0 4 7 8
``````

Which is similar as A, E, H, and I if you happen to map 0 to A, 1 to B, and so forth.