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.

A344841 a(n) is the least positive number not of the form a(k) XOR ... XOR a(m) with 1 <= k <= m < n (where XOR denotes the bitwise XOR operator).

This page as a plain text file.
%I A344841 #16 Sep 02 2025 09:22:19
%S A344841 1,2,4,5,8,12,14,16,17,19,20,21,23,32,33,35,48,49,51,56,57,59,64,65,
%T A344841 67,68,69,71,76,77,79,80,81,83,84,85,87,92,93,95,128,129,131,132,133,
%U A344841 135,140,141,143,192,193,195,196,197,199,204,205,207,224,225,227
%N A344841 a(n) is the least positive number not of the form a(k) XOR ... XOR a(m) with 1 <= k <= m < n (where XOR denotes the bitwise XOR operator).
%C A344841 This sequence has similarities with A002048; here we use XOR, there addition.
%C A344841 All powers of 2 appear.
%H A344841 Rémy Sigrist, <a href="/A344841/b344841.txt">Table of n, a(n) for n = 1..10000</a>
%F A344841 Apparently, a(A246360(k)) = 2^(k-1) for any k > 0.
%e A344841   n   a(n)  a(k) XOR ... XOR a(n) for k=1..n
%e A344841   --  ----  -------------------------------------
%e A344841    1     1  1
%e A344841    2     2  3, 2
%e A344841    3     4  7, 6, 4
%e A344841    4     5  2, 3, 1, 5
%e A344841    5     8  10, 11, 9, 13, 8
%e A344841    6    12  6, 7, 5, 1, 4, 12
%e A344841    7    14  8, 9, 11, 15, 10, 2, 14
%e A344841    8    16  24, 25, 27, 31, 26, 18, 30, 16
%e A344841    9    17  9, 8, 10, 14, 11, 3, 15, 1, 17
%e A344841   10    19  26, 27, 25, 29, 24, 16, 28, 18, 2, 19
%o A344841 (PARI) s=2^0; for (n=1, #a=vector(61), print1 (a[n]=valuation(s+1, 2)", "); z=0; forstep (k=n, 1, -1, s=bitor(s, 2^z=bitxor(z,a[k]))))
%o A344841 (Python)
%o A344841 from operator import xor
%o A344841 from itertools import count, accumulate, islice
%o A344841 from collections import deque
%o A344841 def A344841_gen(): # generator of terms
%o A344841     aset, alist = set(), deque()
%o A344841     for k in count(1):
%o A344841         if k in aset:
%o A344841             aset.remove(k)
%o A344841         else:
%o A344841             yield k
%o A344841             aset |= set(k^d for d in accumulate(alist,xor))
%o A344841             alist.appendleft(k)
%o A344841 A344841_list = list(islice(A344841_gen(),60)) # _Chai Wah Wu_, Sep 01 2025
%Y A344841 Cf. A002048, A246360.
%K A344841 nonn,base,changed
%O A344841 1,2
%A A344841 _Rémy Sigrist_, May 29 2021