\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{#1}}
\fancyhf{} % delete current header and footer
\fancyhead[RE]{\thepage  \hspace*{7mm} \bfseries\leftmark  }
\fancyhead[LO]{\bfseries\rightmark\hspace*{7mm} \thepage  }
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
}
\usepackage{xepersian}

\begin{document}
\chapter{آشنایی با نظریه‌ی اعداد}
\section{چند معادله سیّاله}
متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. \newpage  
متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. \newpage  
متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. متن می‌نویسم. \newpage 


\end{document}