Query: What dynasty ended in December 1004?
Context: When Ibn Sina was 22 years old, he lost his father. The Samanid dynasty came to its end in December 1004. Ibn Sina seems to have declined the offers of Mahmud of Ghazni, and proceeded westwards to Urgench in modern Turkmenistan, where the vizier, regarded as a friend of scholars, gave him a small monthly stipend.