Zachary has a private zoo. He has five groups of animals in his zoo: snakes, birds, mammals, insects, and spiders. Assume that, typically: animals have 1 head, snakes have 0 legs, birds have 2 legs, mammals have 4 legs, insects have 6 legs, and spiders have 8 legs. Zachary has some unusual animals in his zoo. He has: a snake with 3 heads, a bird with 2 heads, a mammal with 3 legs, an insect with 4 legs, and a spider with 7 legs.
1) There are a total of 100 heads and 376 legs.
2) Each group has a different quantity of animals.
3) The most populous group has 10 more members than the least populous group.
4) There are twice as many insect legs as there are bird legs.
5) There are as many snake heads as there are spider heads.
From the following information, determine how many of each group of animals that Zachary has in his menagerie.
There are 3 extra heads
There is a deficiency of 4 legs
Eliminating the 5 mutants, there are 92 heads, 376-16 = 360 legs
Including the mutants, but if you un-mutated them, there would be 97 heads and 380 legs.
There are 97 animals total
There is a difference of 10 between most populous and least populous groups. Let n be the number in the least populous group, n+10 in the most. The other 3 are between n and n+10.
The extreme values of n are found by setting
maxN + 3*maxN + maxN + 10 = 98 maxN = 88/5 = 17.6
and
minN + 3*(minN+ 10) + minN + 10 = 98 minN = 58/5 = 11.6
So the size of the smallest group can be from {12,13,14,15,16,17}
And the size of the largest group can be from {22,23,24,25,26,27}
Not counting the mutants, the average legs per animal is 360/93 = 3.87
Number of spiders is 2 more than number of snakes.
Spiders cannot be 12 or 13; snakes cannot be 26 or 27
birdlegs = 2*birds
insectlegs = 6*insects - 2
insectlegs = 2*birdlegs = 4*birds
6*insects - 2 = 4*birds
3*insects = 2*birds + 1
insects is odd, birds is 1 mod 3
With the group size contraints, the group size of (insects,birds) is limited to
{(13,19),(15,22),(17,25)}
(snakes, birds, mammals, insects, spiders) = (19, 25, 15, 17, 21)
snk, brd, mam, ins, spi
number 19, 25, 15, 17, 21 <---
heads 21, 26, 15, 17, 21 total heads 100
legs 0, 50, 59, 100, 167 total legs 376
----------
import numpy as np
answer = []
for insects in [13,15,17]:
birds = int(1.5*insects - .5)
for spiders in range(14,28):
if spiders == insects or spiders == birds:
continue
snakes = spiders - 2
if snakes == insects or snakes == birds:
continue
for mammals in range(12,28):
if mammals == insects or mammals == birds or mammals == spiders or mammals == snakes:
continue
# groupNums = [insects,birds,spiders,snakes,mammals]
groupNums = [snakes, birds, mammals, insects, spiders]
if max(groupNums) - min(groupNums) != 10:
continue
if sum(groupNums) != 97:
continue
legarray = np.multiply([0,2,4,6,8],[groupNums])
legs = np.sum(legarray)
if legs != 380:
continue
print(groupNums)
answer = groupNums
|
Posted by Larry
on 2023-12-04 18:06:35 |