In this paper, using properties of Ramanujan sums and of the discrete Fourier transform of arithmetic functions, we give an explicit formula for the number of solutions of the linear congruence class="mathmlsrc">title="View the MathML source" class="mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si1.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=3d7accee7ffdc07316f2a1f95c6fc05d">class="imgLazyJSB inlineImage" height="16" width="217" alt="View the MathML source" title="View the MathML source" src="/sd/grey_pxl.gif" data-inlimgeid="1-s2.0-S0022314X16302013-si1.gif">class="mathContainer hidden">class="mathCode">, with class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si2.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=a88d9f985ecd3e3a9d99522d3dbd70e0" title="Click to view the MathML source">gcd(xi,n)=ticlass="mathContainer hidden">class="mathCode"> (class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si199.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=336bb509162c0d3a9ac48daf933e13be" title="Click to view the MathML source">1≤i≤kclass="mathContainer hidden">class="mathCode">), where class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si4.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=e1b405fde4fda511ea9382deb41a36c9" title="Click to view the MathML source">a1,t1,…,ak,tk,b,nclass="mathContainer hidden">class="mathCode"> (class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si16.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=aa6305b31f5c4009b2fd05ef6a0ac9ec" title="Click to view the MathML source">n≥1class="mathContainer hidden">class="mathCode">) are arbitrary integers. As a consequence, we derive necessary and sufficient conditions under which the above restricted linear congruence has no solutions. The number of solutions of this kind of congruence was first considered by Rademacher in 1925 and Brauer in 1926, in the special case of class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si6.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=c1809322cbfb0fdbccd5baec4e622656" title="Click to view the MathML source">ai=ti=1class="mathContainer hidden">class="mathCode">class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si7.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=0547e290b77712403c266d9d64f2a3ac" title="Click to view the MathML source">(1≤i≤k)class="mathContainer hidden">class="mathCode">. Since then, this problem has been studied, in several other special cases, in many papers; in particular, Jacobson and Williams [Duke Math. J. 39 (1972) 521–527] gave a nice explicit formula for the number of such solutions when class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si8.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=fbb1cce0eb40e3f4b7a65d967de9023f" title="Click to view the MathML source">(a1,…,ak)=ti=1class="mathContainer hidden">class="mathCode">class="mathmlsrc">class="formulatext stixSupport mathImg" data-mathURL="/science?_ob=MathURL&_method=retrieve&_eid=1-s2.0-S0022314X16302013&_mathId=si7.gif&_user=111111111&_pii=S0022314X16302013&_rdoc=1&_issn=0022314X&md5=0547e290b77712403c266d9d64f2a3ac" title="Click to view the MathML source">(1≤i≤k)class="mathContainer hidden">class="mathCode">. The problem is very well-motivated and has found intriguing applications in several areas of mathematics, computer science, and physics, and there is promise for more applications/implications in these or other directions.