Section 24B. Whoever assaults a child under sixteen with intent to commit a rape, as defined in section thirty-nine of chapter two hundred and seventy-seven, shall be punished by imprisonment in the state prison for life or for any term of years; and whoever over the age of eighteen commits a subsequent such offense shall be punished by imprisonment in the state prison for life or for any term of years but not less than five years.
Whoever commits any offense described in this section while being armed with a firearm, rifle, shotgun, machine gun or assault weapon shall be punished by imprisonment in the state prison for life or for any term of years, but not less than ten years. Whoever over the age of 18 commits a second or subsequent such offense shall be punished by imprisonment in the state prison for life or for any term of years, but not less than 15 years.