I used to skip months and after 4-6 months, when i get mensus they started to last for 20+ days.

In this we have two scenarios:
1- If you used to see certain number of days before the problem, like 5 days, and the number was constant, then you should consider your period as 5 days, after which you need to perform ghusl, and start praying.

The blood you see thereafter is called istihādha, which is 3 types:
A- Slight istiḥāḍah is when the blood only stains a piece of cotton and does not seep into it.
B- Medium istiḥāḍah is when the blood seeps into a piece of cotton – albeit into only one side of it – but it does not reach the sanitary pad [or other absorbent item] that a woman would normally use to absorb the discharge of blood.
C- Excessive istiḥāḍah is when the blood soaks a piece of cotton and reaches the sanitary pad [or other absorbent item].

Hence, you need to know which type you have.
If you have the Slight istiḥāḍah, then, you must perform one wuḍūʾ for every prayer (ie. 5 times) and must wash the outside of the vagina with water if there is blood there. It is also preferred to purify the piece of cotton with water or change it for every prayer.

If you have medium istiḥāḍah, you need must, based on obligatory precaution, perform one ghusl daily for your prayers, and you must do the things that were mentioned in the previous ruling with regard to slight istiḥāḍah. Therefore, if you experienced medium istiḥāḍah before or at the time of morning (ṣubḥ) prayers, you must perform ghusl for ṣubḥ prayers.
If you intentionally or forgetfully did not perform ghusl for ṣubḥ prayers, you must perform ghusl for midday (ẓuhr) and afternoon (ʿaṣr) prayers. And if you did not perform ghusl for ẓuhr and ʿaṣr prayers, you must perform ghusl before prayers after sunset (maghrib) and evening (ʿishāʾ) prayers, whether the bleeding has stopped or not.
You also need to perform wuḍū after this ghusl, in addition to it.

If you have excessive istiḥāḍah, you need to perform one ghusl for ṣubḥ prayers, one for ẓuhr and ʿaṣr prayers, and one for maghrib and ʿishāʾ prayers. Furthermore, you must not delay between ẓuhr and ʿaṣr prayers nor between maghrib and ʿishāʾ prayers; and if you did, then you must perform ghusl again for ʿaṣr and ʿishāʾ prayers.
You also, based on obligatory precaution, must change or purify with water the piece of cotton and the sanitary pad [or other absorbent item].

In this scenario, it is advisable that after the 10th day, you once again perform mensus ghusl, as precautionary action, and perform wudu as well.

2- If the number of days was not constant, but it it was not exceeding 10 days, then you can choose the number that best suites your period at that time, and relay on it, after which, you should follow the istiḥāḍah rules mentioned above.