login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A280998 Numbers with a prime number of 1's in their binary reflected Gray code representation. 5
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, 39, 41, 43, 45, 47, 48, 49, 51, 53, 55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 96, 97, 99, 101, 103 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

From Emeric Deutsch, Jan 28 2018: (Start) Also the indices of the compositions that have a prime number of parts. For the definition of the index of a composition see _A298644_. For example, 27 is in the sequence since its binary form is 11011 and the composition [2,1,2] has 3 parts. 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. The command c(n) from the Maple program yields the composition having index n. (End)

LINKS

Indranil Ghosh, Table of n, a(n) for n = 1..10001

Wikipedia, Gray code.

EXAMPLE

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.

MAPLE

Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: 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: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 175 do if isprime(nops(c(n))) = true then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to W. Edwin Clark. # Emeric Deutsch, Jan 28 2018

MATHEMATICA

Select[Range[100], PrimeQ[DigitCount[BitXor[#, Floor[#/2]], 2, 1]] &] (* Amiram Eldar, May 01 2021 *)

PROG

(PARI) is(n)=isprime(hammingweight(bitxor(n, n>>1))) \\ Charles R Greathouse IV, Jan 12 2017

CROSSREFS

Cf. A014550, A052294, A005811, A298644, A101211.

Sequence in context: A171599 A328594 A288174 * A043687 A087118 A249115

Adjacent sequences:  A280995 A280996 A280997 * A280999 A281000 A281001

KEYWORD

nonn,base,easy

AUTHOR

Indranil Ghosh, Jan 12 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 13 20:25 EDT 2021. Contains 345009 sequences. (Running on oeis4.)