OFFSET
1,2
EXAMPLE
. n | a(n) | A058977 trajectory
. ---+---------+---------------------------------------------------------
. 2 | 5 | 1/a(2)-5/2-7
. 3 | 164 | 1/a(3)-19/3-13/2-4
. 4 | 501 | 1/a(4)-253/2-25/3-9/2-11
. 5 | 7364 | 1/a(5)-499/3-253/2-25/3-9/2-11
. 6 | 29121 | 1/a(6)-14563/2-979/3-493/2-19/3-13/2-4
. 7 | 515504 | 1/a(6)-34375/3-17191/2-535/3-271/2-23/3-15/2-17
. 8 | 2445693 | 1/a(8)-1222849/2-58241/3-14563/2-979/3-493/2-19/3-13/2-4
PROG
(Haskell)
import Data.List (elemIndex); import Data.Maybe (fromJust)
a247468 = (+ 1) . fromJust . (`elemIndex` a247462_list)
(PARI) f2(p, q) = my(f=factor(p+q)[, 1]~); vecsum(f)/#f;
f1(r) = f2(numerator(r), denominator(r));
loop(list) = {my(v=Vecrev(list)); for (i=2, #v, if (v[i] == v[1], return(1)); ); }
f(n) = {my(ok=0, m=f2(n, 1), list=List(), nb=1); while(denominator(m) != 1, m = f1(m); nb++; listput(list, m); if (loop(list), return (0)); ); return(nb); } \\ A247462
a(n) = my(k=1); while(f(k) != n, k++); k; \\ Michel Marcus, Feb 09 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Reinhard Zumkeller, Sep 17 2014
EXTENSIONS
a(9) from Michel Marcus, Feb 09 2022
STATUS
approved