OFFSET
1,1
LINKS
Claudia Spiro, An Iteration Problem Involving the Divisor Function, Acta Arithmetica, Vol. 46, No. 3 (1986), pp. 215-225.
MATHEMATICA
nmax=10; lst=ConstantArray[0, nmax]; For[n=2, n<10^6, n++; c=1; v={}; m=0; s=1; a=n; i={}; While[m<10^6, AppendTo[v, a]; If[Length[v] > 3, i=LongestCommonSubsequencePositions[v[[1;; -3]], v[[-2;; -1]]], i = {}];
If[Length[i]==2 && Differences[i[[1]]][[1]]==1, c=Length[v]-i[[1]][[1]]-1; Break[]]; m++; a = a + s*DivisorSigma[0, a]; s = -s; ]; If[c/2<nmax && lst[[c/2]] == 0, lst[[c/2]]=n]]; lst (* Amiram Eldar, Jun 05 2017 *)
PROG
(PARI) findpos(v, new) = {for(i=1, #v, if (v[#v-i+1] == new, return (i)); ); }
loop(n) = {my(k = 1, ok = 0, v = []); while(!ok, new = n + k*numdiv(n); if (pos = findpos (v, new), if (#v > pos, if (v[#v] == v[#v - pos], return (pos)); ); ); n = new; k = -k; v = concat(v, new); ); }
a(n) = my(k=3); while (loop(k) != 2*n, k++); k;
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Michel Marcus, Jun 05 2017
EXTENSIONS
a(19)-a(27) from Giovanni Resta, Jun 06 2017
STATUS
approved