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.
%I A280998 #31 Oct 11 2023 04:39:29 %S A280998 2,4,5,6,8,9,11,12,13,14,16,17,19,21,23,24,25,27,28,29,30,32,33,35,37, %T A280998 39,41,43,45,47,48,49,51,53,55,56,57,59,60,61,62,64,65,67,69,71,73,75, %U A280998 77,79,81,83,85,87,89,91,93,95,96,97,99,101,103 %N A280998 Numbers with a prime number of 1's in their binary reflected Gray code representation. %C A280998 From _Emeric Deutsch_, Jan 28 2018: (Start) %C A280998 Also the indices of the compositions that have a prime number of parts. For the definition of the index of a composition see A298644. %C A280998 For example, 27 is in the sequence since its binary form is 11011 and the composition [2,1,2] has 3 parts. %C A280998 On the other hand, 58 is not in the sequence since its binary form is 111010 and the composition [3,1,1,1] has 4 parts. %C A280998 The command c(n) from the Maple program yields the composition having index n. (End) %H A280998 Indranil Ghosh, <a href="/A280998/b280998.txt">Table of n, a(n) for n = 1..10001</a> %H A280998 Wikipedia, <a href="https://en.wikipedia.org/wiki/Gray_code">Gray code</a>. %e A280998 27 is in the sequence because the binary reflected Gray code representation of 27 is 10110 which has 3 1's, and 3 is prime. %p A280998 Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: %p A280998 for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: %p A280998 r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: %p A280998 RunLengths := proc (L) map(nops, Runs(L)) end proc: %p A280998 c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: %p A280998 A := {}: for n to 175 do if isprime(nops(c(n))) = true then A := `union`(A, {n}) else end if end do: A; %p A280998 # most of the program is due to _W. Edwin Clark_. # _Emeric Deutsch_, Jan 28 2018 %t A280998 Select[Range[100], PrimeQ[DigitCount[BitXor[#, Floor[#/2]], 2, 1]] &] (* _Amiram Eldar_, May 01 2021 *) %o A280998 (PARI) is(n)=isprime(hammingweight(bitxor(n, n>>1))) \\ _Charles R Greathouse IV_, Jan 12 2017 %Y A280998 Cf. A014550, A052294, A005811, A298644, A101211. %K A280998 nonn,base,easy %O A280998 1,1 %A A280998 _Indranil Ghosh_, Jan 12 2017