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.

A351887 a(n) is the number of k < n such that a(k) AND n = a(k) (where AND denotes the bitwise AND operator).

This page as a plain text file.
%I A351887 #13 Mar 01 2022 14:51:31
%S A351887 0,1,1,3,1,4,2,7,1,5,2,8,3,8,6,15,1,6,3,11,2,8,7,18,4,9,8,19,7,14,14,
%T A351887 31,1,7,4,13,4,12,10,24,5,12,9,21,11,22,19,40,1,8,5,17,5,18,13,35,8,
%U A351887 19,15,34,15,32,28,63,1,9,4,15,6,18,12,31,7,18,11
%N A351887 a(n) is the number of k < n such that a(k) AND n = a(k) (where AND denotes the bitwise AND operator).
%C A351887 The definition is recursive: a(n) depends on prior terms (a(0), ..., a(n-1)); a(0) = 0 corresponds to an empty sum.
%H A351887 Rémy Sigrist, <a href="/A351887/b351887.txt">Table of n, a(n) for n = 0..10000</a>
%e A351887 The first terms, alongside the corresponding k's, are:
%e A351887   n   a(n)  k's
%e A351887   --  ----  ------------------------
%e A351887    0     0  {}
%e A351887    1     1  {0}
%e A351887    2     1  {0}
%e A351887    3     3  {0, 1, 2}
%e A351887    4     1  {0}
%e A351887    5     4  {0, 1, 2, 4}
%e A351887    6     2  {0, 5}
%e A351887    7     7  {0, 1, 2, 3, 4, 5, 6}
%e A351887    8     1  {0}
%e A351887    9     5  {0, 1, 2, 4, 8}
%e A351887   10     2  {0, 6}
%e A351887   11     8  {0, 1, 2, 3, 4, 6, 8, 10}
%e A351887   12     3  {0, 5, 11}
%p A351887 a:= proc(n) option remember; add(
%p A351887      `if`(Bits[And](n, a(j))=a(j), 1, 0), j=0..n-1)
%p A351887     end:
%p A351887 seq(a(n), n=0..80);  # _Alois P. Heinz_, Feb 28 2022
%o A351887 (PARI) for (n=1, #a=vector(75), print1 (a[n]=sum(k=1, n-1, bitand(a[k], n-1)==a[k])", "))
%o A351887 (Python)
%o A351887 a = []
%o A351887 [a.append(sum(a[k] & n == a[k] for k in range(n))) for n in range(75)]
%o A351887 print(a) # _Michael S. Branicky_, Feb 24 2022
%Y A351887 Cf. A088167, A350802, A351886.
%K A351887 nonn,base
%O A351887 0,4
%A A351887 _Rémy Sigrist_, Feb 23 2022