This file is indexed.

/usr/share/yacas/numbers.rep/nthroot.ys is in yacas 1.3.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//////
// $Id: nthroot.ys,v 1.5 2007-05-17 11:56:45 ayalpinkus Exp $
// calculation/simplifaction of nth roots of nonnegative integers
// NthRoot         - interface function
// NthRoot'Calc    - actually calculate/simplifies
// NthRoot'List    - list table entries for a given n
// NthRoot'Restore - get a root from lookup table
// NthRoot'Save    - save a root in lookup table
// NthRoot'Clear   - clear lookup table
//////

// LocalSymbols(m,n,r,
//		NthRoot'Table,
//		NthRoot'Calc,
//		NthRoot'List,
//		NthRoot'Restore,
//		NthRoot'Save,
//		NthRoot'Clear)
LocalSymbols(m,n,r,
             NthRoot'Table)
[

// interface function for nth root of m
// m>=0, n>1, integers
// m^(1/n) --> f*(r^(1/n))
NthRoot(m_IsNonNegativeInteger,n_IsInteger)_(n>1) <--
[
   Local(r);
   r:=NthRoot'Restore(m,n);
   If(Length(r)=0,
   [
      r:=NthRoot'Calc(m,n);
      NthRoot'Save(m,n,r);
   ]);
   r;
];

// internal functions
Function("NthRoot'Calc",{m,n})
[
   Local(i,j,f,r,in);
   Set(i,2);
   Set(j,Ceil(FastPower(m,N(1.0/n))+1));
   Set(f,1);
   Set(r,m);
   // for large j (approx >4000)
   // using Factors instead of the
   // following.  would this be 
   // faster in general?
//Echo("i j ",i," ",j);
   While(LessThan(i,j))
   [
      Set(in,MathPower(i,n));
//Echo("r in mod ",r, " ",in," ",MathMod(r,in));
      While(Equals(MathMod(r,in),0))
      [
	 Set(f,MathMultiply(f,i));
	 Set(r,MathDiv(r,in));
      ];
      While(Equals(MathMod(r,i),0))   //
	 Set(r,MathDiv(r,i));         //
      //Set(i,NextPrime(i));
      Set(i,NextPseudoPrime(i));
      Set(j,Ceil(FastPower(r,N(1.0/n))+1));
   ];
   //List(f,r);
   List(f,MathDiv(m,MathPower(f,n))); //
];

// lookup table utilities
Function("NthRoot'List",{n})
[
   If(Length(NthRoot'Table)>0,
   [
      Local(p,xx);
      p:=Select({{xx},Head(xx)=n},NthRoot'Table);
      If(Length(p)=1,Tail(p[1]),List());
   ],
   List());
];

Function("NthRoot'Restore",{m,n})
[
   Local(p);
   p:=NthRoot'List(n);
   If(Length(p)>0,
   [
      Local(r,xx);
      r:=Select({{xx},Head(xx)=m},p);
      If(Length(r)=1,Head(Tail(r[1])),List());
   ],
   List());
];

Function("NthRoot'Save",{m,n,r})
[
   Local(p);
   p:=NthRoot'List(n);
   If(Length(p)=0,
   // create power list and save root
   DestructiveInsert(NthRoot'Table,1,List(n,List(m,r))),
   [
      Local(rr,xx);
      rr:=Select({{xx},Head(xx)=m},p);
      If(Length(rr)=0,
      [
	 // save root only
	 DestructiveAppend(p,List(m,r));
      ],
      // already saved
      False);
   ]);
];

//TODO why is NthRoot'Table both lazy global and protected with LocalSymbols?
Function("NthRoot'Clear",{}) SetGlobalLazyVariable(NthRoot'Table,List());

// create empty table
NthRoot'Clear();

]; // LocalSymbols(m,n,r,NthRoot'Table);

//////
//////