OFFSET
1,5
COMMENTS
LINKS
FORMULA
a(n) = max { a(p)+1 ; prime(p) is > 3 and divides prime(n)-1 } union { 1 } - M. F. Hasler, Apr 16 2007
MAPLE
MATHEMATICA
a [n_] := a[n] = Module[{p, pf, e, res}, If[PrimeQ[n], pf = FactorInteger[n-1]; res = 1; For[e = 1, e <= Length[pf], e++, p = pf[[e, 1]]; If[p > 3, res = Max[res, a[p]+1]]]; Return[res], -1]]; Table[a[Prime[n]], {n, 1, 105}] (* Jean-François Alcover, Dec 13 2013, translated from Maple *)
PROG
(PARI) A126805(n) = { if( n>0, n=-prime(n)); if(( n=factor(-1-n)[, 1] ) & n[ #n]>3, vecsort( vector( #n, i, A126805(-n[i]) ))[ #n]+1, 1) } \\ M. F. Hasler, Apr 16 2007
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
R. J. Mathar, Feb 23 2007
STATUS
approved