Quick answer
Seven days is the sweet spot, enough to do two full-day hikes, the Pico do Arieiro sunrise, a north-coast loop, Porto Santo as a day trip, plus Funchal time. Five days works if you skip Porto Santo. Three days is enough to see Funchal, one viewpoint and one short levada, but you'll want to come back.
Context
A typical first-time itinerary that holds together: day 1 Funchal old town, day 2 levada walk (Caldeirão Verde or Levada do Rei), day 3 east tip (Ponta de São Lourenço + Machico), day 4 Pico do Arieiro sunrise + south-coast pool afternoon, day 5 north-coast loop (Santana, São Vicente, Porto Moniz), day 6 west coast (Calheta, Paúl da Serra, Fanal), day 7 buffer / Porto Santo day trip.
Madeira distances look short on a map but mountain roads slow everything down, assume 30 km/h average outside the expressways.
Many visitors who stay 10+ days end up returning to favourite spots rather than discovering new ones: the island is small enough that a week covers the headline sights.