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.

A341242 Numbers whose binary representation encodes a subset S of the natural numbers such that the XOR of the binary representations of all s in S gives 0.

This page as a plain text file.
%I A341242 #22 Feb 23 2021 15:05:12
%S A341242 0,1,14,15,50,51,60,61,84,85,90,91,102,103,104,105,150,151,152,153,
%T A341242 164,165,170,171,194,195,204,205,240,241,254,255,770,771,780,781,816,
%U A341242 817,830,831,854,855,856,857,868,869,874,875,916,917,922,923,934,935,936
%N A341242 Numbers whose binary representation encodes a subset S of the natural numbers such that the XOR of the binary representations of all s in S gives 0.
%C A341242 The numbers for which the set S of positions of bits 1 in the binary representation, interpreted as a set of distinct-sized Nim heaps (including a possible uninteresting size 0 heap for the least significant bit) is losing for the player to move.
%C A341242 Viewing the list as a set of valid code words, every natural number N can be "corrected" to a valid code word by changing exactly one bit, in exactly one way. The position of that bit is found by computing for N the XOR of its raised-bit positions of the title (if the result is 0, then N is already valid but flipping the irrelevant bit 0 makes it valid again).
%C A341242 The "error correcting" interpretation, applied to 64-bit numbers interpreted as orientation of 64 coins, corresponds to a solution of the "coins on a chessboard" puzzle described in the Nick Berry's blog, and also mentioned at A253315.
%C A341242 Numbers 2*n and 2*n+1 for n = A075926(m).
%C A341242 Numbers m such that A253315(m) = 0. - _Rémy Sigrist_, Feb 09 2021
%H A341242 Nick Berry, <a href="https://datagenetics.com/blog/december12014/index.html">Impossible Escape?</a>, DataGenetics blog, December 2014.
%F A341242 a(2*n+1) = 2*A075926(n), a(2*n+2) = 2*A075926(n) + 1 for any n >= 0. - _Rémy Sigrist_, Feb 09 2021
%o A341242 (C++) (first 2^12 terms)
%o A341242 for (int i=0; i<65536; ++i)  {
%o A341242     int sum=0;
%o A341242     for (int n=i, count=0; n>0; n>>=1,++count)
%o A341242       if ((n&1)!=0)
%o A341242         sum ^= count;
%o A341242     if (sum==0)
%o A341242       std::cout << i << ", ";
%o A341242   }
%o A341242 (Python)
%o A341242 def ok(n):
%o A341242   xor, b = 0, (bin(n)[2:])[::-1]
%o A341242   for i, c in enumerate(b):
%o A341242     if c == '1': xor ^= i
%o A341242   return xor == 0
%o A341242 print([m for m in range(937) if ok(m)]) # _Michael S. Branicky_, Feb 07 2021
%Y A341242 Cf. A075926, A253315.
%K A341242 nonn,base
%O A341242 1,3
%A A341242 _Marc A. A. van Leeuwen_, Feb 07 2021