cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A232747 Inverse function to Hofstadter's A005228.

This page as a plain text file.
%I A232747 #14 Dec 09 2021 03:23:17
%S A232747 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 A232747 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 A232747 10,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0
%N A232747 Inverse function to Hofstadter's A005228.
%C A232747 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 A232747 Note that a(n)*A232749(n) = 0 for all n.
%C A232747 Used to compute the permutation A232751.
%H A232747 <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F A232747 a(1)=1, and for n>1, a(n) = A232746(n) * (A232746(n)-A232746(n-1)).
%t A232747 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 A232747 a46[n_] := For[k = 1, True, k++, If[A5228[[k]] > n, Return[k - 1]]];
%t A232747 a[n_] := If[n == 1, 1, a46[n] (a46[n] - a46[n - 1])];
%t A232747 Array[a, nmax] (* _Jean-François Alcover_, Dec 09 2021 *)
%o A232747 (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o A232747 (definec (A232747 n) (cond ((< n 2) n) (else (* (A232746 n) (- (A232746 n) (A232746 (- n 1)))))))
%Y A232747 A030124 gives the positions of zeros.
%Y A232747 Cf. A005228, A232746, A232749, A232751.
%K A232747 nonn
%O A232747 1,3
%A A232747 _Antti Karttunen_, Nov 30 2013