%I #55 Apr 25 2020 13:05:43
%S 0,1,1,2,2,3,2,4,3,3,3,4,3,5,4,5,5,6,4,7,5,7,5,8,6,6,6,9,6,10,6,11,7,
%T 11,7,12,10,13,8,13,8,14,8,15,9,14,9,15,9,10,10,16,10,17,10,17,10,18,
%U 11,19,10,20,12,19,19,21,12,22,13,22,13,23,11,24,14,23,14,25,14,26,14,15,15
%N a(0)=0; for n >= 1, a(n) = 1 + a(n-d(n)), where d(n) is the number of divisors of n (A000005).
%C From _Antti Karttunen_, Sep 23 2015: (Start)
%C Number of steps needed to reach zero when starting from k = n and repeatedly applying the map that replaces k by k - d(k), where d(k) is the number of divisors of k (A000005).
%C The original name was: a(n) = 1 + a(n-sigma_0(n)), a(0)=0, sigma_0(n) number of divisors of n.
%C (End)
%H Antti Karttunen, <a href="/A155043/b155043.txt">Table of n, a(n) for n = 0..124340</a>
%H B. Balamohan, A. Kuznetsov and S. Tanny, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL10/Tanny/tanny3.html">On the behavior of a variant of Hofstadter's Q-sequence</a>, J. Integer Sequences, Vol. 10 (2007), #07.7.1.
%H Antti Karttunen, <a href="/A155043/a155043.png">Graph plotted with OEIS Plot script up to n=10000</a>
%H John A. Pelesko, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL7/Pelesko/pel11.html">Generalizing the Conway-Hofstadter $10,000 Sequence</a>, Journal of Integer Sequences, Vol. 7 (2004), Article 04.3.5.
%F From _Antti Karttunen_, Sep 23 2015 & Nov 26 2015: (Start)
%F a(0) = 0; for n >= 1, a(n) = 1 + a(A049820(n)).
%F a(n) = A262676(n) + A262677(n). - Oct 03 2015.
%F Other identities. For all n >= 0:
%F a(A259934(n)) = a(A261089(n)) = a(A262503(n)) = n. [The sequence works as a left inverse for sequences A259934, A261089 and A262503.]
%F a(n) = A262904(n) + A263254(n).
%F a(n) = A263270(A263266(n)).
%F A263265(a(n), A263259(n)) = n.
%F (End)
%p with(numtheory): a := proc (n) if n = 0 then 0 else 1+a(n-tau(n)) end if end proc: seq(a(n), n = 0 .. 90); # _Emeric Deutsch_, Jan 26 2009
%t a[0] = 0; a[n_] := a[n] = 1 + a[n - DivisorSigma[0, n]]; Table[a@n, {n, 0, 82}] (* _Michael De Vlieger_, Sep 24 2015 *)
%o (PARI)
%o uplim = 110880; \\ = A002182(30).
%o v155043 = vector(uplim);
%o v155043[1] = 1; v155043[2] = 1;
%o for(i=3, uplim, v155043[i] = 1 + v155043[i-numdiv(i)]);
%o A155043 = n -> if(!n,n,v155043[n]);
%o for(n=0, uplim, write("b155043.txt", n, " ", A155043(n)));
%o \\ _Antti Karttunen_, Sep 23 2015
%o (Scheme) (definec (A155043 n) (if (zero? n) n (+ 1 (A155043 (A049820 n)))))
%o ;; _Antti Karttunen_, Sep 23 2015
%o (Haskell)
%o import Data.List (genericIndex)
%o a155043 n = genericIndex a155043_list n
%o a155043_list = 0 : map ((+ 1) . a155043) a049820_list
%o -- _Reinhard Zumkeller_, Nov 27 2015
%o (Python)
%o from sympy import divisor_count as d
%o def a(n): return 0 if n==0 else 1 + a(n - d(n))
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 03 2017
%Y Cf. A000005, A049820, A060990, A259934.
%Y Sum of A262676 and A262677.
%Y Cf. A261089 (positions of records, i.e., the first occurrence of n), A262503 (the last occurrence), A262505 (their difference), A263082.
%Y Cf. A262518, A262519 (bisections, compare their scatter plots), A262521 (where the latter is less than the former).
%Y Cf. A261085 (computed for primes), A261088 (for squares).
%Y Cf. A262507 (number of times n occurs in total), A262508 (values occurring only once), A262509 (their indices).
%Y Cf. A263265 (nonnegative integers arranged by the magnitude of a(n)).
%Y Cf. also A263077, A263078, A263079, A263080.
%Y Cf. also A261104, A262680, A262904, A263254, A263259, A263260, A263266, A263270.
%Y Cf. also A004001, A005185.
%Y Cf. A264893 (first differences), A264898 (where repeating values occur).
%K nonn,look
%O 0,4
%A _Ctibor O. Zizka_, Jan 19 2009
%E Extended by _Emeric Deutsch_, Jan 26 2009
%E Name edited by _Antti Karttunen_, Sep 23 2015