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.

A360706 a(n) is the least positive number not yet used such that its binary representation has either all or none of its 1-bits in common with the XOR of a(1) to a(n-1).

This page as a plain text file.
%I A360706 #51 Sep 01 2024 16:49:34
%S A360706 1,2,3,4,8,12,5,10,6,9,7,16,17,24,14,11,18,20,13,15,19,32,36,21,25,26,
%T A360706 22,23,27,33,37,28,34,30,29,40,42,31,64,96,35,68,38,44,41,43,39,48,56,
%U A360706 45,65,66,46,47,67,80,52,49,57,50,82,69,97,51,53,60,54,55,58,72,73,59,61,76,70,71,74
%N A360706 a(n) is the least positive number not yet used such that its binary representation has either all or none of its 1-bits in common with the XOR of a(1) to a(n-1).
%C A360706 The lexicographically earliest permutation of positive numbers such that the nim-sum of the first k elements equals the nim-sum of k-1 elements with the element at position k either arithmetically added or subtracted.
%C A360706 The first occurrence of a number m >= 2^k is always m = 2^k.
%C A360706 All positive integers will appear in this sequence: see link section for details.
%H A360706 Rémy Sigrist, <a href="/A360706/b360706.txt">Table of n, a(n) for n = 1..10000</a>
%H A360706 Thomas Scheuerle, <a href="/A360706/a360706.png">Scatterplot red: a(n) blue: a(1) XOR...XOR a(n-1) for n = 1...50000</a>
%H A360706 Thomas Scheuerle, <a href="/A360706/a360706.txt">Proof that all positive integers will appear in this sequence</a>
%H A360706 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%H A360706 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A360706 If a(m1) = 2^k and a(m2) = 2^k-1 then m1 - 2^k < 0 and m2 - (2^k-1) > 0 for k > 2.
%e A360706    n    a(n)  a(n) in binary   a(1) XOR ... XOR a(n-1) in binary
%e A360706 ------------------------------------------------------------------
%e A360706    1     1          1b             0b
%e A360706    2     2         10b             1b
%e A360706    3     3         11b            11b
%e A360706    4     4        100b             0b
%e A360706    5     8       1000b           100b
%e A360706    6    12       1100b          1100b
%e A360706    7     5        101b             0b
%e A360706 ...
%e A360706 Signed version of this sequence such that the arithmetic sum over the first k values equals the nim-sum over the first k values of the original sequence:
%e A360706 1, 2, -3, 4, 8, -12, 5, 10, -6, -9, 7, 16, -17, 24, -14, 11, -18, 20, -13, ...
%o A360706 (MATLAB)
%o A360706 function a = A360706( max_n )
%o A360706     s = 0; a = []; t = [1:max_n];
%o A360706     for n = 1:max_n
%o A360706         k = 1;
%o A360706         while (t(k) ~= bitand(s,t(k)))&&(0 ~= bitand(s,t(k)))
%o A360706             k = k+1;
%o A360706         end
%o A360706         s = bitxor(s,t(k));
%o A360706         a(n) = t(k);
%o A360706         t(k) = max(t)+1; t = sort(t);
%o A360706     end
%o A360706 end
%o A360706 (PARI) { m = s = 0; for (n = 1, 77, for (v = 1, oo, if (!bittest(s, v), x = bitand(m, v); if (x==0 || x==v, s += 2^v; m = bitxor(m, v); print1 (v", "); break;);););); } \\ _Rémy Sigrist_, Aug 31 2024
%Y A360706 Cf. A000120, A116624, A269868, A330647, A360363, A375856.
%K A360706 nonn,base
%O A360706 1,2
%A A360706 _Thomas Scheuerle_, Feb 17 2023