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 36 results. Next

A245445 Permutation of nonnegative integers: a(n) = A056539(A193231(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 22 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A056539(A193231(n)).

A245446 Permutation of nonnegative integers: a(n) = A193231(A056539(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 22 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A193231(A056539(n)).

A280503 a(n) = A091255(n,A056539(n)).

Original entry on oeis.org

1, 2, 3, 2, 5, 2, 7, 2, 9, 10, 1, 12, 1, 2, 15, 2, 17, 2, 1, 2, 21, 2, 3, 4, 1, 2, 27, 4, 3, 2, 31, 2, 33, 6, 7, 18, 1, 38, 5, 6, 1, 42, 3, 2, 45, 6, 1, 12, 7, 2, 51, 52, 3, 18, 1, 56, 5, 6, 1, 12, 1, 2, 63, 2, 65, 2, 1, 2, 1, 2, 3, 2, 73, 2, 15, 2, 3, 2, 7, 2, 1, 2, 9, 2, 85, 2, 1, 2, 3, 2, 1, 2, 93, 2, 5, 4, 1, 2, 99, 4, 9, 2, 1, 4, 15, 2, 107, 4, 1, 2, 3, 8
Offset: 1

Views

Author

Antti Karttunen, Jan 09 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A091255(n,A056539(n)).
Other identities. For all n >= 1:
a(A056539(n)) = a(n).
A048720(a(n), A280504(n)) = n.

A357522 Reverse run lengths in binary expansions of terms of A063037: for n >= 0, a(n) is the unique k such that A063037(1+k) = A056539(A063037(1+n)).

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 8, 11, 10, 9, 16, 17, 18, 15, 12, 13, 14, 19, 32, 23, 22, 21, 24, 31, 28, 27, 26, 29, 30, 25, 20, 33, 42, 49, 48, 43, 44, 47, 50, 41, 34, 37, 38, 53, 52, 39, 36, 35, 40, 51, 46, 45, 74, 75, 84, 65, 58, 59, 64, 85, 86, 63, 60, 57, 66, 83
Offset: 0

Views

Author

Rémy Sigrist, Oct 02 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 42:
- A063037(1+42) = 86,
- the binary expansion of 86 is "1010110",
- reversing run lengths yields "1001010",
- this corresponds to 74 = A063037(1+34),
- hence a(42) = 34.
		

Crossrefs

See A357523 for a similar sequence.

Programs

  • PARI
    See Links section.

Formula

a(n) = n iff n = 0 or A044813(1+n) belongs to A044918.

A357523 Reverse run lengths in binary expansions of terms of A166535: for n > 0, a(n) is the unique k such that A166535(k) = A056539(A166535(n)); a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 14, 9, 10, 13, 12, 11, 8, 15, 20, 23, 24, 19, 16, 27, 26, 17, 18, 25, 22, 21, 40, 41, 46, 35, 32, 49, 50, 31, 36, 45, 42, 39, 28, 29, 38, 43, 44, 37, 30, 51, 48, 33, 34, 47, 88, 63, 62, 89, 94, 57, 68, 83, 80, 71, 54, 53, 72, 79, 84, 67
Offset: 0

Views

Author

Rémy Sigrist, Oct 02 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 42:
- A166535(42) = 50,
- the binary expansion of 50 is "110010",
- reversing run lengths yields "101100",
- this corresponds to 44 = A166535(38),
- hence a(42) = 38.
		

Crossrefs

See A357522 for a similar sequence.

Programs

  • PARI
    See Links section.

Formula

a(n) = n iff n = 0 or A166535(n) belongs to A044918.

A105726 Involution of nonnegative integers. A deeply recursive variant of A056539.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 14, 9, 10, 13, 12, 11, 8, 63, 126, 17, 22, 25, 26, 21, 18, 29, 28, 19, 20, 27, 24, 23, 64, 31, 62, 129, 46, 49, 54, 41, 38, 57, 58, 37, 42, 53, 50, 45, 34, 253, 252, 35, 44, 51, 52, 43, 36, 59, 56, 39, 40, 55, 192, 191, 32, 15, 30, 65, 382, 385, 110
Offset: 0

Views

Author

Antti Karttunen, Apr 18 2005

Keywords

Comments

Keyword "look" refers especially to the scatterplot image by Rémy Sigrist, which has a strong resemblance to an FPGA architecture diagram. - Antti Karttunen, Dec 25 2024

Examples

			By definition a(0)=0 and a(1)=1.
a(2)=2, as 2 = 10 in binary, thus its run counts are (1 1), which reversed yields the same (1 1), from which we collect a binary number 10, i.e. 2 in decimal.
a(4)=6, as 4 = 100 in binary, thus its run counts are (1 2), which reversed and each element mapped through a itself yields (2 1), which are run counts of binary number 110, i.e. 6 in decimal.
a(16)=126, as 16 = 10000 in binary, thus its run counts are (1 4), which reversed yields (4 1) and a(4)=6 and a(1)=1, thus we find that the run counts (6 1) form a binary 1111110 i.e. 126 in decimal.
		

Crossrefs

Differs from its "shallow" version A056539 first time at n=15, where A056539(15)=15, but here a(15)=63.

Programs

  • Scheme
    (define (A105726 n) (cond ((< n 2) n) (else (runcount1list->binexp (map A105726 (reverse! (binexp->runcount1list n))))))) (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2))))))) (define (runcount1list->binexp lista) (let loop ((lista lista) (s 0) (state 1)) (cond ((null? lista) s) (else (loop (cdr lista) (+ (* s (expt 2 (car lista))) (* state (- (expt 2 (car lista)) 1))) (- 1 state))))))

A153150 Self-inverse permutation of natural numbers: A059893-conjugate of A056539.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 20 2008

Keywords

Crossrefs

a(n) = A059893(A056539(A059893(n))).

A357527 Reverse run lengths in binary expansions of terms of A044813: for n > 0, a(n) is the unique k such that A044813(k) = A056539(A044813(n)); a(0) = 0.

Original entry on oeis.org

0, 1, 2, 4, 3, 5, 7, 6, 8, 12, 11, 10, 9, 13, 23, 18, 20, 22, 15, 21, 16, 19, 17, 14, 24, 36, 29, 33, 35, 26, 34, 32, 31, 27, 30, 28, 25, 37, 55, 44, 47, 49, 52, 54, 39, 53, 51, 40, 50, 41, 48, 46, 42, 45, 43, 38, 56, 82, 63, 68, 76, 79, 81, 58, 69, 73, 80, 78
Offset: 0

Views

Author

Rémy Sigrist, Oct 02 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 42:
- A044813(42) = 159,
- the binary expansion of 159 is "10011111",
- reversing run lengths yields "11111001",
- this corresponds to 249 = A044813(52),
- hence a(42) = 52.
		

Crossrefs

See A057164, A357522 and A357523 for similar sequences.

Programs

  • PARI
    See Links section.

Formula

a(n) = n iff n = 0 or A044813(n) belongs to A044918.

A357530 Reverse run lengths in binary expansions of terms of A031443: for n > 0, a(n) is the unique k such that A031443(k) = A056539(A031443(n)); a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 11, 8, 7, 6, 9, 12, 5, 10, 13, 14, 45, 41, 31, 18, 38, 28, 21, 22, 27, 37, 36, 26, 23, 20, 29, 39, 17, 32, 42, 46, 35, 25, 24, 19, 30, 40, 16, 33, 43, 47, 15, 34, 44, 48, 49, 170, 165, 150, 115, 54, 161, 146, 111, 58, 136, 101, 68, 81, 88, 123
Offset: 0

Views

Author

Rémy Sigrist, Oct 02 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 42:
- A031443(42) = 210,
- the binary expansion of 210 is "11010010",
- reversing run lengths yields "10110100",
- this corresponds to 180 = A031443(33),
- hence a(42) = 33.
		

Crossrefs

See A057164 for a similar sequence.

Programs

  • PARI
    See Links section.

Formula

a(n) = n iff n = 0 or A031443(n) belongs to A044918.

A005811 Number of runs in binary expansion of n (n>0); number of 1's in Gray code for n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Starting with a(1) = 0 mirror all initial 2^k segments and increase by one.
a(n) gives the net rotation (measured in right angles) after taking n steps along a dragon curve. - Christopher Hendrie (hendrie(AT)acm.org), Sep 11 2002
This sequence generates A082410: (0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, ...) and A014577; identical to the latter except starting 1, 1, 0, ...; by writing a "1" if a(n+1) > a(n); if not, write "0". E.g., A014577(2) = 0, since a(3) < a(2), or 1 < 2. - Gary W. Adamson, Sep 20 2003
Starting with 1 = partial sums of A034947: (1, 1, -1, 1, 1, -1, -1, 1, 1, 1, ...). - Gary W. Adamson, Jul 23 2008
The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
Can be used as a binomial transform operator: Let a(n) = the n-th term in any S(n); then extract 2^k strings, adding the terms. This results in the binomial transform of S(n). Say S(n) = 1, 3, 5, ...; then we obtain the strings: (1), (3, 1), (3, 5, 3, 1), (3, 5, 7, 5, 3, 5, 3, 1), ...; = the binomial transform of (1, 3, 5, ...) = (1, 4, 12, 32, 80, ...). Example: the 8-bit string has a sum of 32 with a distribution of (1, 3, 3, 1) or one 1, three 3's, three 5's, and one 7; as expected. - Gary W. Adamson, Jun 21 2012
Considers all positive odd numbers as nodes of a graph. Two nodes are connected if and only if the sum of the two corresponding odd numbers is a power of 2. Then a(n) is the distance between 2n + 1 and 1. - Jianing Song, Apr 20 2019

Examples

			Considered as a triangle with 2^k terms per row, the first few rows are:
  1
  2, 1
  2, 3, 2, 1
  2, 3, 4, 3, 2, 3, 2, 1
  ...
The n-th row becomes right half of next row; left half is mirrored terms of n-th row increased by one. - _Gary W. Adamson_, Jun 20 2012
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A037834 (-1), A088748 (+1), A246960 (mod 4), A034947 (first differences), A000975 (indices of record highs), A173318 (partial sums).
Partial sums of A112347. Recursion depth of A035327.

Programs

  • Haskell
    import Data.List (group)
    a005811 0 = 0
    a005811 n = length $ group $ a030308_row n
    a005811_list = 0 : f [1] where
       f (x:xs) = x : f (xs ++ [x + x `mod` 2, x + 1 - x `mod` 2])
    -- Reinhard Zumkeller, Feb 16 2013, Mar 07 2011
    
  • Maple
    A005811 := proc(n)
        local i, b, ans;
        if n = 0 then
            return 0 ;
        end if;
        ans := 1;
        b := convert(n, base, 2);
        for i from nops(b)-1 to 1 by -1 do
            if b[ i+1 ]<>b[ i ] then
                ans := ans+1
            fi
        od;
        return ans ;
    end proc:
    seq(A005811(i), i=1..50) ;
    # second Maple program:
    a:= n-> add(i, i=Bits[Split](Bits[Xor](n, iquo(n, 2)))):
    seq(a(n), n=0..100);  # Alois P. Heinz, Feb 01 2023
  • Mathematica
    Table[ Length[ Length/@Split[ IntegerDigits[ n, 2 ] ] ], {n, 1, 255} ]
    a[n_] := DigitCount[BitXor[n, Floor[n/2]], 2, 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 11 2024 *)
  • PARI
    a(n)=sum(k=1,n,(-1)^((k/2^valuation(k,2)-1)/2))
    
  • PARI
    a(n)=if(n<1,0,a(n\2)+(a(n\2)+n)%2) \\ Benoit Cloitre, Jan 20 2014
    
  • PARI
    a(n) = hammingweight(bitxor(n, n>>1));  \\ Gheorghe Coserea, Sep 03 2015
    
  • Python
    def a(n): return bin(n^(n>>1))[2:].count("1") # Indranil Ghosh, Apr 29 2017

Formula

a(2^k + i) = a(2^k - i + 1) + 1 for k >= 0 and 0 < i <= 2^k. - Reinhard Zumkeller, Aug 14 2001
a(2n+1) = 2a(n) - a(2n) + 1, a(4n) = a(2n), a(4n+2) = 1 + a(2n+1).
a(j+1) = a(j) + (-1)^A014707(j). - Christopher Hendrie (hendrie(AT)acm.org), Sep 11 2002
G.f.: (1/(1-x)) * Sum_{k>=0} x^2^k/(1+x^2^(k+1)). - Ralf Stephan, May 02 2003
Delete the 0, make subsets of 2^n terms; and reverse the terms in each subset to generate A088696. - Gary W. Adamson, Oct 19 2003
a(0) = 0, a(2n) = a(n) + [n odd], a(2n+1) = a(n) + [n even]. - Ralf Stephan, Oct 20 2003
a(n) = Sum_{k=1..n} (-1)^((k/2^A007814(k)-1)/2) = Sum_{k=1..n} (-1)^A025480(k-1). - Ralf Stephan, Oct 29 2003
a(n) = A069010(n) + A033264(n). - Ralf Stephan, Oct 29 2003
a(0) = 0 then a(n) = a(floor(n/2)) + (a(floor(n/2)) + n) mod 2. - Benoit Cloitre, Jan 20 2014
a(n) = A037834(n) + 1.
a(n) = A000120(A003188(n)). - Amiram Eldar, Jul 11 2024

Extensions

Additional description from Wouter Meeussen
Showing 1-10 of 36 results. Next