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.

A095283 Primes whose binary-expansion ends with an odd number of 1's.

Original entry on oeis.org

5, 7, 13, 17, 23, 29, 31, 37, 41, 53, 61, 71, 73, 89, 97, 101, 103, 109, 113, 127, 137, 149, 151, 157, 167, 173, 181, 193, 197, 199, 223, 229, 233, 241, 257, 263, 269, 277, 281, 293, 311, 313, 317, 337, 349, 353, 359, 373, 383, 389, 397, 401, 409
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Crossrefs

Intersection of A000040 & A079523. Complement of A095282 in A000040. Cf. A027697, A095293.

Programs

  • Maple
    q:= proc(n) local i, l, r; l, r:= convert(n, base, 2), 0;
          for i to nops(l) while l[i]=1 do r:=r+1 od; is(r, odd)
        end:
    select(q, [ithprime(i)$i=1..150])[];  # Alois P. Heinz, Dec 15 2019
  • Mathematica
    Select[Prime[Range[100]], MatchQ[IntegerDigits[#, 2], {b:(1)..}|{_, 0, b:(1)..} /; OddQ[Length[{b}]]]&] (* Jean-François Alcover, Jan 03 2022 *)
  • PARI
    is(n)=valuation(n+1,2)%2 && isprime(n) \\ Charles R Greathouse IV, Oct 09 2013
    
  • Python
    from sympy import isprime
    def ok(n): b = bin(n); return (len(b)-len(b.rstrip("1")))%2 and isprime(n)
    print([k for k in range(1, 401) if ok(k)]) # Michael S. Branicky, Jan 03 2022