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.

Showing 1-10 of 23 results. Next

A228495 Characteristic function of the odd odious numbers (A092246).

Original entry on oeis.org

0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0
Offset: 0

Views

Author

Ralf Stephan, Aug 23 2013

Keywords

Comments

The following sequences all appear to have the same parity: A003071, A029886, A061297, A092524, A093431, A102393, A104258, A122248, A128975. - Jeremy Gardiner, Dec 28 2008.
a(n+1) is the characteristic function of the even evil numbers (A125592). - Jeremy Gardiner, Feb 06 2015

Crossrefs

Programs

  • Mathematica
    a[n_] := If[OddQ[n] && OddQ[DigitCount[n, 2, 1]], 1, 0]; Array[a, 100, 0] (* Amiram Eldar, Aug 06 2023 *)
  • PARI
    a(n)=if(n%2==0,0,subst(Pol(binary((n-1)/2)),x,1)%2==0)
    
  • PARI
    A228495(n) = ((n%2)&&(hammingweight(n)%2)); \\ Antti Karttunen, Jan 12 2019
    
  • Python
    def A228495(n): return n.bit_count()&1&n # Chai Wah Wu, Mar 03 2023

Formula

a(2n) = 0, a(2n+1) = A092436(n).
a(n) = A000035(n) * A010060(n). - Antti Karttunen, Jan 12 2019

A268673 a(0) = 0; a(1) = 1; for n > 1, a(n) = 1 + 4*A092246(n-1).

Original entry on oeis.org

0, 1, 5, 29, 45, 53, 77, 85, 101, 125, 141, 149, 165, 189, 197, 221, 237, 245, 269, 277, 293, 317, 325, 349, 365, 373, 389, 413, 429, 437, 461, 469, 485, 509, 525, 533, 549, 573, 581, 605, 621, 629, 645, 669, 685, 693, 717, 725, 741, 765, 773, 797, 813, 821, 845, 853, 869, 893, 909, 917, 933, 957, 965, 989, 1005
Offset: 0

Views

Author

Antti Karttunen, Feb 19 2016

Keywords

Comments

Seems to be also the fixed points of permutations A268823 and A268824.

Crossrefs

Cf. also A092246, A268717.
Many (but not all) terms of A013710 seem to be included.

Programs

  • Mathematica
    Join[{0, 1}, 1 + 4 Select[Range[1, 251, 2], OddQ[Total[IntegerDigits[#, 2]]]&]] (* Jean-François Alcover, Mar 15 2016 *)
  • Python
    def A268673(n): return (((m:=n-2)<<4)+(13 if m.bit_count()&1 else 5)) if n>1 else n # Chai Wah Wu, Mar 03 2023
  • Scheme
    (define (A268673 n) (if (<= n 1) n (+ 1 (* 4 (A092246 (- n 1))))))
    

Formula

a(0) = 0; a(1) = 1; for n > 1, a(n) = 1 + 4*A092246(n-1).

A254614 Union of odd odious (A092246) and evil (A001969) numbers.

Original entry on oeis.org

0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 23, 24, 25, 27, 29, 30, 31, 33, 34, 35, 36, 37, 39, 40, 41, 43, 45, 46, 47, 48, 49, 51, 53, 54, 55, 57, 58, 59, 60, 61, 63, 65, 66, 67, 68, 69, 71, 72, 73, 75, 77, 78, 79, 80, 81, 83, 85, 86, 87, 89
Offset: 1

Views

Author

Jeremy Gardiner, Feb 03 2015

Keywords

Comments

Complement of A128309 (Even odious numbers).

Examples

			A128309 begins 2,4,8, hence this sequence begins 0,1,3,5,6,7.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 100], OddQ[#] || !OddQ[DigitCount[#, 2, 1]] &] (* Amiram Eldar, Aug 07 2023 *)

A014580 Binary irreducible polynomials (primes in the ring GF(2)[X]), evaluated at X=2.

Original entry on oeis.org

2, 3, 7, 11, 13, 19, 25, 31, 37, 41, 47, 55, 59, 61, 67, 73, 87, 91, 97, 103, 109, 115, 117, 131, 137, 143, 145, 157, 167, 171, 185, 191, 193, 203, 211, 213, 229, 239, 241, 247, 253, 283, 285, 299, 301, 313, 319, 333, 351, 355, 357, 361, 369, 375
Offset: 1

Views

Author

David Petry (petry(AT)accessone.com)

Keywords

Comments

Or, binary irreducible polynomials, interpreted as binary vectors, then written in base 10.
The numbers {a(n)} are a subset of the set {A206074}. - Thomas Ordowski, Feb 21 2014
2^n - 1 is a term if and only if n = 2 or n is a prime and 2 is a primitive root modulo n. - Jianing Song, May 10 2021
For odd k, k is a term if and only if binary_reverse(k) = A145341((k+1)/2) is. - Joerg Arndt and Jianing Song, May 10 2021

Examples

			x^4 + x^3 + 1 -> 16+8+1 = 25. Or, x^4 + x^3 + 1 -> 11001 (binary) = 25 (decimal).
		

Crossrefs

Written in binary: A058943.
Number of degree-n irreducible polynomials: A001037, see also A000031.
Multiplication table: A048720.
Characteristic function: A091225. Inverse: A091227. a(n) = A091202(A000040(n)). Almost complement of A091242. Union of A091206 & A091214 and also of A091250 & A091252. First differences: A091223. Apart from a(1) and a(2), a subsequence of A092246 and hence A000069.
Table of irreducible factors of n: A256170.
Irreducible polynomials satisfying particular conditions: A071642, A132447, A132449, A132453, A162570.
Factorization sentinel: A278239.
Sequences analyzing the difference between factorization into GF(2)[X] irreducibles and ordinary prime factorization of the corresponding integer: A234741, A234742, A235032, A235033, A235034, A235035, A235040, A236850, A325386, A325559, A325560, A325563, A325641, A325642, A325643.
Factorization-preserving isomorphisms: A091203, A091204, A235041, A235042.
See A115871 for sequences related to cross-domain congruences.
Functions based on the irreducibles: A305421, A305422.

Programs

  • Mathematica
    fQ[n_] := Block[{ply = Plus @@ (Reverse@ IntegerDigits[n, 2] x^Range[0, Floor@ Log2@ n])}, ply == Factor[ply, Modulus -> 2] && n != 2^Floor@ Log2@ n]; fQ[2] = True; Select[ Range@ 378, fQ] (* Robert G. Wilson v, Aug 12 2011 *)
    Reap[Do[If[IrreduciblePolynomialQ[IntegerDigits[n, 2] . x^Reverse[Range[0, Floor[Log[2, n]]]], Modulus -> 2], Sow[n]], {n, 2, 1000}]][[2, 1]] (* Jean-François Alcover, Nov 21 2016 *)
  • PARI
    is(n)=polisirreducible(Pol(binary(n))*Mod(1,2)) \\ Charles R Greathouse IV, Mar 22 2013

A027697 Odious primes: primes with odd number of 1's in binary expansion.

Original entry on oeis.org

2, 7, 11, 13, 19, 31, 37, 41, 47, 59, 61, 67, 73, 79, 97, 103, 107, 109, 127, 131, 137, 151, 157, 167, 173, 179, 181, 191, 193, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 313, 331, 367, 379, 397, 409, 419, 421, 431, 433, 439, 443, 457, 463, 487, 491, 499, 521, 541, 557, 563
Offset: 1

Views

Author

Keywords

Comments

Conjecture: a(n) < A027699(n) except for n = 2; verified up to n=5*10^7. Moreover, I conjecture that A027699(n) - a(n) tends to infinity. - Vladimir Shevelev

Crossrefs

Cf. A000069 (odious numbers), A092246 (odd odious numbers)

Programs

  • Maple
    a:=proc(n) local nn: nn:= convert(ithprime(n), base, 2): if `mod`(sum(nn[j], j =1..nops(nn)), 2)=1 then ithprime(n) else end if end proc: seq(a(n),n=1..103); # Emeric Deutsch, Oct 24 2007
  • Mathematica
    Clear[BinSumOddQ];BinSumOddQ[a_]:=Module[{i,s=0},s=0;For[i=1,i<=Length[IntegerDigits[a,2]],s+=Extract[IntegerDigits[a,2],i];i++ ];OddQ[s]]; lst={};Do[p=Prime[n];If[BinSumOddQ[p],AppendTo[lst,p]],{n,4!}];lst (* Vladimir Joseph Stephan Orlovsky, Apr 06 2009 *)
    Select[Prime@ Range@ 120, OddQ@ First@ DigitCount[#, 2] &] (* Michael De Vlieger, Feb 08 2016 *)
  • PARI
    f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==1,s++));return(s%2)};
    forprime(p=2, 563, if(f(p), print1(p,", "))) \\ Washington Bomfim, Jan 14 2011
    
  • PARI
    s=[]; forprime(p=2, 1000, if(norml2(binary(p))%2==1, s=concat(s, p))); s \\ Colin Barker, Feb 18 2014
    
  • Python
    from sympy import primerange
    print([n for n in primerange(1, 1001) if bin(n)[2:].count("1")%2]) # Indranil Ghosh, May 03 2017

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A003071 Sorting numbers: maximal number of comparisons for sorting n elements by list merging.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 14, 17, 25, 27, 30, 33, 38, 41, 45, 49, 65, 67, 70, 73, 78, 81, 85, 89, 98, 101, 105, 109, 115, 119, 124, 129, 161, 163, 166, 169, 174, 177, 181, 185, 194, 197, 201, 205, 211, 215, 220, 225, 242, 245, 249, 253, 259, 263, 268, 273, 283, 287, 292, 297, 304
Offset: 1

Views

Author

Keywords

Comments

The following sequences all appear to have the same parity: A003071, A029886, A061297, A092524, A093431, A102393, A104258, A122248, A128975. - Jeremy Gardiner, Dec 28 2008
a(A092246(n)) = A230720(n); a(A230709(n)) = A230721(n+1). - Reinhard Zumkeller, Oct 28 2013

References

  • D. E. Knuth, Art of Computer Programming, Vol. 3, Sections 5.2.4 and 5.3.1.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003071 n = 1 - 2 ^ last es +
       sum (zipWith (*) (zipWith (+) es [0..]) (map (2 ^) es))
       where es = reverse $ a133457_row n
    -- Reinhard Zumkeller, Oct 28 2013
  • Mathematica
    a[1] = 0; a[n_] := a[n] = a[n-1] + 2^IntegerExponent[n-1, 2] + DigitCount[n-1, 2, 1] - 1; Table[a[n], {n, 1, 61}] (* Jean-François Alcover, Feb 10 2012, after Henry Bottomley *)

Formula

Let n = 2^e_1 + 2^e_2 + ... + 2^e_t, e_1 > e_2 > ... > e_t >= 0, t >= 1. Then a(n) = 1 - 2^e_t + Sum_{k=1..t} (e_k + k - 1)*2^e_k [Knuth, Problem 14, Section 5.2.4].
a(n) = a(n-1) + A061338(n) = a(n-1) + A006519(n) + A000120(n) - 1 = n + A000337(A000523(n)) + a(n - 2^A000523(n)). a(2^k) = k*2^k + 1 = A002064(k). - Henry Bottomley, Apr 27 2001
G.f.: x/(1-x)^3 + 1/(1-x)^2*Sum(k>=1, (-1+(1-x)*2^(k-1))*x^2^k/(1-x^2^k)). - Ralf Stephan, Apr 17 2003

Extensions

More terms from David W. Wilson

A268717 Permutation of natural numbers: a(0) = 0, a(n) = A003188(1+A006068(n-1)), where A003188 is binary Gray code and A006068 is its inverse.

Original entry on oeis.org

0, 1, 3, 6, 2, 12, 4, 7, 5, 24, 8, 11, 9, 13, 15, 10, 14, 48, 16, 19, 17, 21, 23, 18, 22, 25, 27, 30, 26, 20, 28, 31, 29, 96, 32, 35, 33, 37, 39, 34, 38, 41, 43, 46, 42, 36, 44, 47, 45, 49, 51, 54, 50, 60, 52, 55, 53, 40, 56, 59, 57, 61, 63, 58, 62, 192, 64, 67, 65, 69, 71, 66, 70, 73, 75, 78, 74, 68, 76, 79, 77, 81
Offset: 0

Views

Author

Antti Karttunen, Feb 12 2016

Keywords

Crossrefs

Inverse: A268718.
Row 1 and column 1 of array A268715 (without the initial zero).
Row 1 of array A268820.
Cf. A092246 (fixed points).
Cf. A268817 ("square" of this permutation).
Cf. A268821 ("shifted square"), A268823 ("shifted cube") and also A268825, A268827 and A268831 ("shifted higher powers").

Programs

Formula

a(n) = A003188(A066194(n)) = A003188(1+A006068(n-1)).
Other identities. For all n >= 0:
A101080(n,a(n+1)) = 1. [The Hamming distance between n and a(n+1) is always one.]
A268726(n) = A000523(A003987(n, a(n+1))). [A268726 gives the index of the toggled bit.]
From Alan Michael Gómez Calderón, May 29 2025: (Start)
a(2*n) = (2*n-1) XOR (2-A010060(n-1)) for n >= 1;
a(n) = (A268718(n-1)-1) XOR (A171977(n-1)+1) for n >= 2. (End)

A129771 Evil odd numbers.

Original entry on oeis.org

3, 5, 9, 15, 17, 23, 27, 29, 33, 39, 43, 45, 51, 53, 57, 63, 65, 71, 75, 77, 83, 85, 89, 95, 99, 101, 105, 111, 113, 119, 123, 125, 129, 135, 139, 141, 147, 149, 153, 159, 163, 165, 169, 175, 177, 183, 187, 189, 195, 197, 201, 207, 209, 215, 219, 221, 225, 231, 235
Offset: 1

Views

Author

Tanya Khovanova, May 16 2007

Keywords

Comments

A heuristic argument suggests that, as n tends to infinity, a(n)/n converges to 4. - Stefan Steinerberger, May 17 2007
These numbers may be called primitive evil numbers because every evil number is a power of 2 multiplied by one of these numbers. Note that the difference between consecutive terms is either 2, 4, or 6. - T. D. Noe, Jun 06 2007
If m is in the sequence, then so is 2m-1 because in binary, m is x1 and 2m-1 is x01. Presumably the numbers that generate the whole sequence by application of n -> 2n-1 are the evil numbers times 4 plus 3. - Ralf Stephan, May 25 2013

Crossrefs

Intersection of A001969 and A005408.
Supersequence of A093688.
Cf. A092246 (odd odious numbers).
Column 2 of A277880, positions of 1's in A277808 (2's in A277822).

Programs

  • Mathematica
    Select[Range[300], OddQ[ # ] && EvenQ[DigitCount[ #, 2, 1]] &] (* Stefan Steinerberger, May 17 2007 *)
    Select[Range[300], EvenQ[Plus @@ IntegerDigits[ #, 2]] && OddQ[ # ] &]
  • PARI
    is(n)=n%2 && hammingweight(n)%2==0 \\ Charles R Greathouse IV, Mar 21 2013
    
  • PARI
    a(n)=4*n-if(hammingweight(n-1)%2,3,1) \\ Charles R Greathouse IV, Mar 21 2013
    
  • Python
    def A129771(n): return (((m:=n-1)<<1)+(m.bit_count()&1^1)<<1)+1 # Chai Wah Wu, Mar 09 2023

Formula

a(n) = 2*A000069(n) + 1. a(n) is 1 plus twice odious numbers.
a(n) = A128309(n) + 1. a(n) is 1 plus odious even numbers.
A132680(a(n)) = A132680((a(n)-1)/2) + 2. - Reinhard Zumkeller, Aug 26 2007
a(n) = 4n + O(1). - Charles R Greathouse IV, Mar 21 2013
a(n) = A001969(1+A000069(n)) = A277902(A277823(n)). - Antti Karttunen, Nov 05 2016

Extensions

More terms from Stefan Steinerberger, May 17 2007

A268718 Permutation of natural numbers: a(0) = 0, a(n) = 1 + A003188(A006068(n)-1), where A003188 is binary Gray code and A006068 is its inverse.

Original entry on oeis.org

0, 1, 4, 2, 6, 8, 3, 7, 10, 12, 15, 11, 5, 13, 16, 14, 18, 20, 23, 19, 29, 21, 24, 22, 9, 25, 28, 26, 30, 32, 27, 31, 34, 36, 39, 35, 45, 37, 40, 38, 57, 41, 44, 42, 46, 48, 43, 47, 17, 49, 52, 50, 54, 56, 51, 55, 58, 60, 63, 59, 53, 61, 64, 62, 66, 68, 71, 67, 77, 69, 72, 70, 89, 73, 76, 74, 78, 80, 75, 79, 113, 81
Offset: 0

Views

Author

Antti Karttunen, Feb 12 2016

Keywords

Crossrefs

Inverse: A268717.
Row 1 of array A268830.
Cf. A092246 (fixed points).
Cf. A268818 ("square" of this permutation).
Cf. A268822 ("shifted square"), A268824 ("shifted cube") and also A268826, A268828 and A268832 (higher "shifted powers").

Programs

  • Mathematica
    {0}~Join~Table[1 + BitXor[#, Floor[#/2]] &[BitXor @@ Table[Floor[n/2^m], {m, 0, Floor[Log[2, n]]}] - 1], {n, 81}] (* Michael De Vlieger, Feb 29 2016, after Jean-François Alcover at A006068 and Robert G. Wilson v at A003188 *)
  • PARI
    a003188(n)=bitxor(n, n>>1);
    a006068(n)= {
        my( s=1, ns );
        while ( 1,
            ns = n >> s;
            if ( 0==ns, break() );
            n = bitxor(n, ns);
            s <<= 1;
        );
        return (n);
    } \\ by Joerg Arndt
    a(n)=if(n==0, 0, 1 + a003188(a006068(n) - 1)); \\ Indranil Ghosh, Jun 07 2017
    
  • Python
    def a003188(n): return n^(n>>1)
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a(n): return 0 if n==0 else 1 + a003188(a006068(n) - 1) # Indranil Ghosh, Jun 07 2017
  • Scheme
    (define (A268718 n) (if (zero? n) n (A105081 (A006068 n))))
    

Formula

a(0) = 0, and for n >= 1, a(n) = A105081(A006068(n)) = 1 + A003188(A006068(n)-1).
Other identities. For all n >= 1:
a(A128309(n)) = A128309(n)+2. [Maps any even odious number to that number + 2.]
From Alan Michael Gómez Calderón, May 29 2025: (Start)
a(n) - 1 = A268717(n+1) XOR (A171977(n)+1) for n >= 1;
a(2*n-1) - 1 = (2-A010060(n-1)) XOR (A166519(n-1)-1) for n >= 1;
a(2*n) - 1 = (a(2*(n+1)-1)-1) XOR 2^A277822(n) for n >= 1. (End)

A230709 Union of even odious (cf. A128309) and evil numbers (cf. A001969).

Original entry on oeis.org

0, 2, 3, 4, 5, 6, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 23, 24, 26, 27, 28, 29, 30, 32, 33, 34, 36, 38, 39, 40, 42, 43, 44, 45, 46, 48, 50, 51, 52, 53, 54, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 70, 71, 72, 74, 75, 76, 77, 78, 80, 82, 83, 84, 85, 86, 88
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 28 2013

Keywords

Comments

Apart from initial zero: numbers m, such that when mergesorting lists of length m, the maximal number of comparisons is odd: A003071(a(n+1)) = A230721(n).

Crossrefs

Cf. A092246 (complement).

Programs

  • Haskell
    a230709 n = a230709_list !! (n-1)
    a230709_list = filter (\x -> a010060 x * x `mod` 2 == 0) [0..]
    
  • Mathematica
    Complement[Range[0, m = 88], Select[Range[1, m, 2], OddQ[ Total[ IntegerDigits[#, 2]]]&]] (* Jean-François Alcover, Dec 15 2018 *)
  • PARI
    is(n)=if(hammingweight(n)%2,n%2==0,1) \\ Charles R Greathouse IV, May 09 2016

Formula

A010060(a(n)) * a(n) mod 2 = 0.
Showing 1-10 of 23 results. Next