login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A288070
a(n) is the least number that enters a cycle of length 2n in the iteration sequence s(0)=n, s(k+1) = s(k) + (-1)^k*d(s(k)), where d(n) is the number of divisors of n (A000005).
1
3, 93, 273, 1617, 684, 3993, 58695, 91355, 572793, 167055, 441519, 13991016, 2337513, 20225991, 48163788, 20625997, 148789675, 470944675, 626064036, 506112555, 963071088, 494359089, 3252701700, 3972446520, 4515893681, 3472027000, 9096968436
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
Cf. A000005, A049820, A062249, A175304 (numbers with cycle of length 2), A285004 (records of this sequence).
Sequence in context: A297479 A116161 A285004 * A116292 A139543 A241982
KEYWORD
nonn,more
AUTHOR
Michel Marcus, Jun 05 2017
EXTENSIONS
a(19)-a(27) from Giovanni Resta, Jun 06 2017
STATUS
approved