%I #14 Dec 09 2021 03:23:17
%S 1,0,2,0,0,0,3,0,0,0,0,4,0,0,0,0,0,5,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,
%T 7,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,
%U 10,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0
%N Inverse function to Hofstadter's A005228.
%C This is an inverse function to Hofstadter's A005228 in the sense that for all n, n = a(A005228(n)). a(n) = 0 when n is not in A005228, but instead in its complement A030124.
%C Note that a(n)*A232749(n) = 0 for all n.
%C Used to compute the permutation A232751.
%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F a(1)=1, and for n>1, a(n) = A232746(n) * (A232746(n)-A232746(n-1)).
%t nmax = 100; A5228 = {1}; Module[{d = 2, k = 1}, Do[While[MemberQ[A5228, d], d++]; k += d; d++; AppendTo[A5228, k], {n, 1, nmax}]];
%t a46[n_] := For[k = 1, True, k++, If[A5228[[k]] > n, Return[k - 1]]];
%t a[n_] := If[n == 1, 1, a46[n] (a46[n] - a46[n - 1])];
%t Array[a, nmax] (* _Jean-François Alcover_, Dec 09 2021 *)
%o (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o (definec (A232747 n) (cond ((< n 2) n) (else (* (A232746 n) (- (A232746 n) (A232746 (- n 1)))))))
%Y A030124 gives the positions of zeros.
%Y Cf. A005228, A232746, A232749, A232751.
%K nonn
%O 1,3
%A _Antti Karttunen_, Nov 30 2013
|