bridge/class-master/depend/pari/src/basemath/arith1.c
/* Ramanujan tau function, return 0 for <= 0 */
Ramanujan tau function, return 0 for <= 0
Ramanujan tau function return 0 for < = 0
GEN
ramanujantau(GEN n)
{
  pari_sp ltop = avma;
  GEN T, F, P, E;
  long j, lP;
  if (!(F = check_arith_all(n,"ramanujantau")))
  {
    if (signe(n) <= 0) return gen_0;
    F = Z_factor(n);
  }
  else
  {
    P = gel(F,1);
    if (lg(P) == 1 || signe(gel(P,1)) <= 0) return gen_0;
  }
  P = gel(F,1);
  E = gel(F,2); lP = lg(P);
  T = gen_1;
  for (j = 1; j < lP; j++)
  {
    GEN p = gel(P,j), tp = tauprime(p), t1 = tp, t0 = gen_1;
    long k, e = itou(gel(E,j));
    for (k = 1; k < e; k++)
    {
      GEN t2 = subii(mulii(tp, t1), mulii(powiu(p, 11), t0));
      t0 = t1; t1 = t2;
    }
    T = mulii(T, t1);
  }
  return gerepileuptoint(ltop, T);
}
GEN ramanujantau ( GEN n ) { pari_sp ltop = avma ; GEN T , F , P , E ; long j , lP ; if ( ! ( F = check_arith_all ( n , " " ) ) ) { if ( signe ( n ) <= 0 ) return gen_0 ; F = Z_factor ( n ) ; } else { P = gel ( F , 1 ) ; if ( lg ( P ) == 1 || signe ( gel ( P , 1 ) ) <= 0 ) return gen_0 ; } P = gel ( F , 1 ) ; E = gel ( F , 2 ) ; lP = lg ( P ) ; T = gen_1 ; for ( j = 1 ; j < lP ; j ++ ) { GEN p = gel ( P , j ) , tp = tauprime ( p ) , t1 = tp , t0 = gen_1 ; long k , e = itou ( gel ( E , j ) ) ; for ( k = 1 ; k < e ; k ++ ) { GEN t2 = subii ( mulii ( tp , t1 ) , mulii ( powiu ( p , 11 ) , t0 ) ) ; t0 = t1 ; t1 = t2 ; } T = mulii ( T , t1 ) ; } return gerepileuptoint ( ltop , T ) ; }
Ramanujan tau function, return 0 for <= 0
Ramanujan tau function return 0 for < = 0