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.

Previous Showing 11-18 of 18 results.

A092246 Odd "odious" numbers (A000069).

Original entry on oeis.org

1, 7, 11, 13, 19, 21, 25, 31, 35, 37, 41, 47, 49, 55, 59, 61, 67, 69, 73, 79, 81, 87, 91, 93, 97, 103, 107, 109, 115, 117, 121, 127, 131, 133, 137, 143, 145, 151, 155, 157, 161, 167, 171, 173, 179, 181, 185, 191, 193, 199, 203, 205, 211, 213, 217, 223, 227, 229, 233
Offset: 1

Views

Author

Benoit Cloitre, Feb 23 2004

Keywords

Comments

In other words, numbers having a binary representation ending in 1, and an odd number of 1's overall. It follows that by decrementing an odd odious number, one gets an even evil number (A125592). - Ralf Stephan, Aug 27 2013
The members of the sequence may be called primitive odious numbers because every odious number is a power of 2 times one of these numbers. Note that the difference between consecutive terms is either 2, 4, or 6. - T. D. Noe, Jun 06 2007
From Gary W. Adamson, Apr 06 2010: (Start)
a(n) = A026147(n)-th odd number, where A026147 = (1, 4, 6, 7, 10, 11, ...); e.g.,
n: 1 2 3 4 5 6 7 8 9 10 11
n-th odd: 1 3 5 7 9 11 13 15 17 19 21
a(n): 1 7 11 13 19 21
etc. (End)
Numbers m, such that when merge-sorting lists of length m, the maximal number of comparisons is even: A003071(a(n)) = A230720(n). - Reinhard Zumkeller, Oct 28 2013
Fixed points of permutation pair A268717/A268718. - Antti Karttunen, Feb 29 2016

Crossrefs

Cf. A230709 (complement).

Programs

  • Haskell
    a092246 n = a092246_list !! (n - 1)
    a092246_list = filter odd a000069_list
    -- Reinhard Zumkeller, Oct 28 2013
    
  • Mathematica
    Table[If[n < 1, 0, 2 n - 1 - Mod[First@ DigitCount[n - 1, 2], 2]], {n, 120}] /. n_ /; EvenQ@ n -> Nothing (* Michael De Vlieger, Feb 29 2016 *)
    Select[Range[1, 1001, 2], OddQ[Total[IntegerDigits[#, 2]]]&] (* Jean-François Alcover, Mar 15 2016 *)
  • PARI
    is(n)=n%2&&hammingweight(n)%2 \\ Charles R Greathouse IV, Mar 21 2013
    
  • PARI
    a(n)=4*n-if(hammingweight(n-1)%2,1,3) \\ Charles R Greathouse IV, Mar 22 2013
    
  • Python
    def A092246(n): return (n<<2)-(1 if (n-1).bit_count()&1 else 3) # Chai Wah Wu, Mar 03 2023

Formula

a(n) = 4*n + 2*A010060(n-1) - 3;
a(n) = 2*A001969(n-1) + 1.

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)

A268715 Square array A(i,j) = A003188(A006068(i) + A006068(j)), read by antidiagonals as A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), A(2,0), ...

Original entry on oeis.org

0, 1, 1, 2, 3, 2, 3, 6, 6, 3, 4, 2, 5, 2, 4, 5, 12, 7, 7, 12, 5, 6, 4, 15, 6, 15, 4, 6, 7, 7, 13, 13, 13, 13, 7, 7, 8, 5, 4, 12, 9, 12, 4, 5, 8, 9, 24, 12, 5, 11, 11, 5, 12, 24, 9, 10, 8, 27, 4, 14, 10, 14, 4, 27, 8, 10, 11, 11, 25, 25, 10, 15, 15, 10, 25, 25, 11, 11, 12, 9, 8, 24, 29, 14, 12, 14, 29, 24, 8, 9, 12, 13, 13, 24, 9, 31, 31, 13, 13, 31, 31, 9, 24, 13, 13
Offset: 0

Views

Author

Antti Karttunen, Feb 12 2016

Keywords

Comments

Each row n is row A006068(n) of array A268820 without its A006068(n) initial terms.

Examples

			The top left [0 .. 15] x [0 .. 15] section of the array:
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
   1,  3,  6,  2, 12,  4,  7,  5, 24,  8, 11,  9, 13, 15, 10, 14
   2,  6,  5,  7, 15, 13,  4, 12, 27, 25,  8, 24, 14, 10,  9, 11
   3,  2,  7,  6, 13, 12,  5,  4, 25, 24,  9,  8, 15, 14, 11, 10
   4, 12, 15, 13,  9, 11, 14, 10, 29, 31, 26, 30,  8, 24, 27, 25
   5,  4, 13, 12, 11, 10, 15, 14, 31, 30, 27, 26,  9,  8, 25, 24
   6,  7,  4,  5, 14, 15, 12, 13, 26, 27, 24, 25, 10, 11,  8,  9
   7,  5, 12,  4, 10, 14, 13, 15, 30, 26, 25, 27, 11,  9, 24,  8
   8, 24, 27, 25, 29, 31, 26, 30, 17, 19, 22, 18, 28, 20, 23, 21
   9,  8, 25, 24, 31, 30, 27, 26, 19, 18, 23, 22, 29, 28, 21, 20
  10, 11,  8,  9, 26, 27, 24, 25, 22, 23, 20, 21, 30, 31, 28, 29
  11,  9, 24,  8, 30, 26, 25, 27, 18, 22, 21, 23, 31, 29, 20, 28
  12, 13, 14, 15,  8,  9, 10, 11, 28, 29, 30, 31, 24, 25, 26, 27
  13, 15, 10, 14, 24,  8, 11,  9, 20, 28, 31, 29, 25, 27, 30, 26
  14, 10,  9, 11, 27, 25,  8, 24, 23, 21, 28, 20, 26, 30, 29, 31
  15, 14, 11, 10, 25, 24,  9,  8, 21, 20, 29, 28, 27, 26, 31, 30
		

Crossrefs

Main diagonal: A001969.
Row 0, column 0: A001477.
Row 1, column 1: A268717.
Antidiagonal sums: A268837.
Cf. A268719 (the lower triangular section).
Cf. also A268725.

Programs

Formula

A(i,j) = A003188(A006068(i) + A006068(j)) = A003188(A268714(i,j)).
A(row,col) = A268820(A006068(row), (A006068(row)+col)).

A066194 A permutation of the integers (a fractal sequence): a(n) = A006068(n-1) + 1.

Original entry on oeis.org

1, 2, 4, 3, 8, 7, 5, 6, 16, 15, 13, 14, 9, 10, 12, 11, 32, 31, 29, 30, 25, 26, 28, 27, 17, 18, 20, 19, 24, 23, 21, 22, 64, 63, 61, 62, 57, 58, 60, 59, 49, 50, 52, 51, 56, 55, 53, 54, 33, 34, 36, 35, 40, 39, 37, 38, 48, 47, 45, 46, 41, 42, 44, 43, 128, 127, 125, 126, 121, 122
Offset: 1

Views

Author

Wouter Meeussen, Dec 15 2001

Keywords

Comments

With an initial zero, inverse of the Gray Code (A003188). See also A006068. - Robert G. Wilson v, Jun 22 2014
I suspect the above comment refers to function A105081(n) = 1 + A003188(n - 1), n >= 1. - Antti Karttunen, Feb 15 2016

Examples

			Third nesting gives {1,2,4,3, 8,7,5,6} by means of joining the lists {1,2,4,3} = second nesting and {8,7,6,5} permuted by {1,2,4,3} giving {8,7,5,6}.
		

Crossrefs

Inverse: A105081.

Programs

  • Mathematica
    Nest[ Join[ #, (Length[ #] + Range[ Length[ #], 1, -1 ])[[ # ]]] &, {1}, 7 ]
    GrayCode[n_] := BitXor[n, Floor[n/2]]; t = Array[ GrayCode, 1000, 0]; Table[ Position[ t, n], {n, 0, 100}] // Flatten (* Robert G. Wilson v, Jun 22 2014 *)
  • Python
    def A066194(n):
        k, m = n-1, n-1>>1
        while m > 0:
            k ^= m
            m >>= 1
        return k+1 # Chai Wah Wu, Jul 01 2022
  • Scheme
    (define (A066194 n) (+ 1 (A006068 (- n 1)))) ;; Antti Karttunen, Feb 14 2016
    

Formula

a(n) = A006068(n-1) + 1, n >= 1. - Philippe Deléham, Apr 29 2005
a(n) = A006068(A268717(n)), composition of related permutations. - Antti Karttunen, Feb 14 2016
a(n) = 1 + Sum_{j=1..n-1} (1/6)*(-3 + (-1)^A007814(j) + 2^(A007814(j) + 3))*(-1)^(A000120(j) + 1). - John Erickson, Oct 18 2018

Extensions

Deléham's formula added to the name by Antti Karttunen, Feb 14 2016

A302027 Permutation of nonnegative integers: a(0) = 0; for n >= 1, a(n) = A057889(1+A057889(n-1)), where A057889 is a bijective bit-reverse.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 11, 12, 15, 16, 17, 18, 25, 22, 21, 26, 27, 30, 19, 20, 29, 28, 23, 24, 31, 32, 33, 34, 49, 38, 41, 42, 51, 46, 37, 50, 53, 54, 43, 58, 55, 62, 35, 36, 57, 44, 45, 52, 59, 60, 39, 40, 61, 56, 47, 48, 63, 64, 65, 66, 97, 70, 81, 74, 99, 78, 73, 82, 101, 86, 83, 90, 103, 94, 69, 98, 105, 102, 85
Offset: 0

Views

Author

Antti Karttunen, Apr 26 2018

Keywords

Crossrefs

Cf. A302028 (inverse).
Cf. A057889.
Cf. also A268717, A302793.

Programs

  • Mathematica
    f[n_] := FromDigits[Reverse[IntegerDigits[n, 2]], 2]*2^IntegerExponent[n, 2]; Fold[Append[#1, f[1 + f[#2 - 1]]] &, {0, 1}, Range[2, 85]] (* Michael De Vlieger, Apr 27 2018, after Ivan Neretin at A057889 *)
  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A057889(n) = if(!n,n,A030101(n/(2^valuation(n,2))) * (2^valuation(n, 2)));
    A302027(n) = if(!n,n,A057889(1+A057889(n-1)));

Formula

a(0) = 0; for n >= 1, a(n) = A057889(1+A057889(n-1)).

A302793 Permutation of nonnegative integers: a(0) = 0; for n >= 1, a(n) = A193231(1+A193231(n-1)), where A193231(n) is blue code of n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 26 2018

Keywords

Crossrefs

Cf. A302794 (inverse).
Cf. also A268717, A302027.

Programs

Formula

a(0) = 0; for n >= 1, a(n) = A193231(1+A193231(n-1)).

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).

A268835 Main diagonal of arrays A268833 & A268834: a(n) = A101080(n, A268820(n, 2*n)).

Original entry on oeis.org

0, 1, 2, 1, 2, 3, 2, 3, 2, 3, 4, 5, 2, 1, 4, 3, 2, 3, 4, 5, 4, 3, 6, 5, 2, 3, 2, 1, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 6, 5, 4, 5, 4, 3, 6, 7, 6, 5, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 6, 5, 4, 3, 4, 3, 2, 3, 4, 5, 4, 3, 6, 5, 4, 5, 4, 3, 6, 7, 6, 5, 4, 5, 6, 5, 4, 5, 4, 5, 6, 7, 8, 7, 6, 5, 6, 5, 2, 3, 4, 3, 4, 5, 4, 5, 2, 3, 4, 5, 2, 1, 4, 3, 4, 5, 6, 5, 6, 5, 6, 5, 4
Offset: 0

Views

Author

Antti Karttunen, Feb 15 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A101080(n, A268820(n, 2*n)).
Previous Showing 11-18 of 18 results.