The numbers from 1 to 150, inclusive, are placed in a bag and a number is randomly selected from the bag. What is the probability it is neither a perfect square nor a perfect cube? Express your answer as a common fraction.
I tried to do this by finding all the perfect squares and perfect cubes over all the numbers: 8/75 and then subtract it from 1, but I got 67/75 which was wrong.
Perfect squares =(1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144)
Perfect Cubes = (1, 8, 27, 64, 125)
Perfect squares + Perfect cubes = 12 + 5 - 2 = 15
150 - 15 = 135 - which are neither Perfect square or Perfect cubes.
So, the probability is = 135 / 150 = 9 / 10
there's probably a number or two in there that are both perfect squares and perfect cubes
\(P[\text{# is neither perfect cube or square}] = 1 - P[\text{it is}] = \\ 1 \\ -P[\text{# is a perfect cube}]\\ -P[\text{# is a perfect square}] \\ +P[\text{# is both a perfect cube and perfect square}]\)
\(P[\text{perfect cube}]=\dfrac{5}{150}=\dfrac{1}{30}\\ P[\text{perfect square}] = \dfrac{12}{150} = \dfrac{2}{25}\\ P[\text{both}] = \dfrac{2}{150}\)
\(P[\text{# is neither cube or square}] = 1 - \dfrac{1}{30}-\dfrac{2}{25}+\dfrac{2}{150}= \dfrac{9}{10}\)