Let ak(n)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$a_k(n)$$\end{document} be defined by & sum;n=0 infinity ak(n)qn=E(q)k\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sum _{n=0}<^>\infty a_k(n)q<^>n=E(q)<^>k$$\end{document}, where E(q)=& prod;n=1 infinity(1-qn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$E(q)=\prod _{n=1}<^>\infty (1-q<^>n) $$\end{document} is Euler's product. In this paper, by means of the modular equations of fifth, seventh and thirteenth order, we give a general method to establish the generating functions for ak(p2 alpha+1n+k(p2 alpha+2-1)24-p2 alpha+1t(p,k))\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$a_k(p<^>{2\alpha +1}n+\frac{k(p<^>{2\alpha +2}-1)}{24}-p<^>{2\alpha +1}t(p,k))$$\end{document}, where 1 <= k <= 24\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$1\le k \le 24$$\end{document}, p is an element of{5,7,13}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p\in \{5,7,13\}$$\end{document} and t(5,k)=k5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t(5,k)=\left[ \frac{k}{5}\right] $$\end{document}, t(7,k)=2k7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t(7,k)=\left[ \frac{2k}{7}\right] $$\end{document} and t(13,k)=7k13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t(13,k)=\left[ \frac{7k}{13}\right] $$\end{document}. These generating functions are determined by some sequences which satisfy the same three-term linear recurrence relations. Based on those generating functions, we present a sufficient condition to find infinite families of congruences for certain kinds of partition functions. As applications of the sufficient condition, we obtain many new infinite families of congruences for certain partition functions, such as, partition functions related to mock theta functions and generalized Frobenius partition functions. In particular, we deduce some strange congruences for those partition functions.