%%%% virer les dvips ps2pdf pour les compil pdflatex

\documentclass[xcolor={hyperref,dvips,ps2pdf,table},dvips]{beamer} 
\usepackage{fancyvrb,amsmath}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}

%%%% un peu de giac/xcas

\makeatletter
\newcommand{\executGiacmp}[1]{
\immediate\write18{giac  <#1 } }
\makeatother

\begin{VerbatimOut}{XCASeratex.cxx}
Eratex(L):={
l:=L[0];c:=L[1];
n:=l*c;

TT:="\\begin{frame}
\\begin{tabular}{*{"+c+"}{|c}|}      
\\cline{2-"+c+"}
    \\multicolumn{1}{c|}{} &";
   for(t:=2;t<=n;t++){TT:=TT+
if(t mod c !=0){"\\cellcolor{yellow}\\color{black}"+t+"&"}
                                        else{"\\cellcolor{yellow}\\color{black}"+t+"\\\\\\hline"}
};
 
TT:=TT+"
                 \\end{tabular}
\\end{frame}

";

M:=NULL;
for(k:=2;k*k<=n;k++){T:=" ";
       if(isprime(k)==1){m:=2; while(k*m<=n){M:=M,k*m;m:=m+1};
      T:=T+"\\begin{frame}
\\begin{tabular}{*{"+c+"}{|c}|}      
\\cline{2-"+c+"}
    \\multicolumn{1}{c|}{} &";
           for(kk:=2;kk<=n;kk++){T:=T+"
                                      "+
                  if(member(kk,M)!=0){
                        if(kk mod c !=0){"\\cellcolor{red}\\color{white}"+kk+"&"}
                                        else{"\\cellcolor{red}\\color{white}"+kk+"\\\\\\hline"}
                                  }else{
                                  if(kk mod c !=0){if(kk==k){"\\cellcolor{orange}\\color{red}\\bfseries"+kk+"&"}
                                             else{"\\cellcolor{yellow}\\color{black}"+kk+"&"}}
                                        else{if(kk==k){"\\cellcolor{orange}\\color{red}\\bfseries"+kk+"\\\\\\hline" }
                                             else{"\\cellcolor{yellow}\\color{black}"+kk+"\\\\\\hline"}}
                                       } 
                                     }
           T:=T+"
                 \\end{tabular}
\\end{frame}

";
TT:=TT+"
"+T
                  }
}
TT;
}:;                 
\end{VerbatimOut}




\begin{VerbatimOut}{XCASeratex.giac}
maple_mode(0);
read("XCASeratex.cxx");
Sortie:=fopen("XCASeratex.tex");
donnees:=read("XCASeratex.user");
Resultat:=cat("Eratex(",donnees);
Resultat:=cat(Resultat,");");
Resultat:=expr(Resultat);
fprint(Sortie,Unquoted,Resultat);
fclose(Sortie);
\end{VerbatimOut}




\newenvironment{eratex}
{\VerbatimEnvironment\begin{VerbatimOut}{XCASeratex.user}}
{\end{VerbatimOut}
           \executGiacmp{XCASeratex.giac}

\input{XCASeratex}
}






%%%%%%%%%%%%%%% un peu de beamer







\mode<presentation>
{
  \usetheme[secheader]{Madrid}
 
  \setbeamercovered{highly dynamic}
 
}


\title[] 
{Le crible d'Ératosthène}

\subtitle{}

\author[]
{Guillaume CONNAN }

\institute{Ami\TeX{}}


\date[]
{1\textsuperscript{er} février 2008}

\subject{}



\beamerdefaultoverlayspecification{<+->}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% fin du préambule


\begin{document}

\begin{frame}
  \titlepage
\end{frame}




\tiny % pour avoir un tableau avec plein de nombres

%%% on demande les premiers de 2 à 32x15=480

\begin{eratex}
32,15
\end{eratex}




\end{document}










%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: