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.

A294991 Let S be the sequence of integer sets defined by the following rules: S(0) = {0}, S(1) = {1} and for any k > 0, S(2*k) = {2*k} U S(k) and S(2*k+1) = {2*k+1} U S(k) U S(k+1) (where X U Y denotes the union of the sets X and Y); a(n) = the number of elements of S(n).

This page as a plain text file.
%I A294991 #27 Jul 23 2023 08:49:13
%S A294991 1,1,2,3,3,4,4,5,4,6,5,6,5,7,6,7,5,8,7,8,6,8,7,8,6,9,8,9,7,9,8,9,6,10,
%T A294991 9,10,8,10,9,10,7,10,9,10,8,10,9,10,7,11,10,11,9,11,10,11,8,11,10,11,
%U A294991 9,11,10,11,7,12,11,12,10,12,11,12,9,12,11,12,10
%N A294991 Let S be the sequence of integer sets defined by the following rules: S(0) = {0}, S(1) = {1} and for any k > 0, S(2*k) = {2*k} U S(k) and S(2*k+1) = {2*k+1} U S(k) U S(k+1) (where X U Y denotes the union of the sets X and Y); a(n) = the number of elements of S(n).
%C A294991 For any n >= 0, a(n) corresponds the number of calls to the "fusc" function (defined by Dijkstra) required to compute A002487(n) with an implementation using memoization, and starting with an empty cache.
%C A294991 The sequence A215673 corresponds to the variant without memoization.
%C A294991 For any n > 0, a(n) <= A215673(n) (with equality iff n is a power of 2).
%C A294991 The scatterplot of the ordinal transform of the sequence shows a network of broken lines.
%C A294991 Also: for n >= 1, a(n)+2 is the number of states in the minimal complete deterministic finite automaton that accepts the base-2 representation of m and m+n in parallel, starting with the most significant digit. - _Jeffrey Shallit_, Jul 22 2023
%H A294991 Rémy Sigrist, <a href="/A294991/a294991.png">Scatterplot of the first 100000 terms of the ordinal transform of the sequence</a>
%H A294991 Rémy Sigrist, <a href="/A294991/a294991_1.png">Illustration of the first terms</a>
%H A294991 <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%F A294991 a(n) = 2*floor(log_2 n) - nu_2(n) + [n is a power of 2] + [1st two bits of n in base 2 are 11] = 2*A000523(n) - A007814(n) + A209229(n) + [n belongs to A004755], for n >= 1. - _Jeffrey Shallit_, Jul 20 2023
%F A294991 a(2*n) = a(n) + 1, n >= 1.
%F A294991 a(4*n+1) = a(2*n+1)+2, n >= 2.
%F A294991 a(4*n+3) = a(2*n+1)+2, n >= 0.
%F A294991 a(2^k) = k + 1 for any k >= 0.
%F A294991 Empirically: a(2*k-1) = 2*A070939(k) - 2*A209229(k) + [(k-1) is in A004760] for any k > 0 (where [P]=1 if P is true and [P]=0 otherwise).
%e A294991 The first terms, alongside the corresponding set S(n), are:
%e A294991 n   a(n)    S(n)
%e A294991 --  ----    -----
%e A294991 0   1       { 0 }
%e A294991 1   1       { 1 }
%e A294991 2   2       { 1, 2 }
%e A294991 3   3       { 1, 2, 3 }
%e A294991 4   3       { 1, 2, 4 }
%e A294991 5   4       { 1, 2, 3, 5 }
%e A294991 6   4       { 1, 2, 3, 6 }
%e A294991 7   5       { 1, 2, 3, 4, 7 }
%e A294991 8   4       { 1, 2, 4, 8 }
%e A294991 9   6       { 1, 2, 3, 4, 5, 9 }
%e A294991 10  5       { 1, 2, 3, 5, 10 }
%e A294991 11  6       { 1, 2, 3, 5, 6, 11 }
%e A294991 12  5       { 1, 2, 3, 6, 12 }
%e A294991 13  7       { 1, 2, 3, 4, 6, 7, 13 }
%e A294991 14  6       { 1, 2, 3, 4, 7, 14 }
%e A294991 15  7       { 1, 2, 3, 4, 7, 8, 15 }
%e A294991 16  5       { 1, 2, 4, 8, 16 }
%e A294991 17  8       { 1, 2, 3, 4, 5, 8, 9, 17 }
%e A294991 18  7       { 1, 2, 3, 4, 5, 9, 18 }
%e A294991 19  8       { 1, 2, 3, 4, 5, 9, 10, 19 }
%e A294991 20  6       { 1, 2, 3, 5, 10, 20 }
%e A294991 See also illustration of the first terms in Links section.
%o A294991 (PARI) a(n) = my (S = Set(n), u = 1); while (u <= #S, my (v = S[#S-u+1]); if (v>1, if (v%2==0, S = setunion(S, Set(v/2)), S = setunion(S, Set([(v-1)/2, (v+1)/2])))); u++;); return (#S)
%Y A294991 Cf. A002487, A004760, A070939, A209229, A215673.
%K A294991 nonn
%O A294991 0,3
%A A294991 _Rémy Sigrist_, Nov 12 2017