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-8 of 8 results.

A106737 a(n) = Sum_{k=0..n} ({binomial(n+k,n-k)*binomial(n,k)} mod 2).

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 3, 4, 2, 4, 4, 6, 3, 6, 4, 5, 2, 4, 4, 6, 4, 8, 6, 8, 3, 6, 6, 9, 4, 8, 5, 6, 2, 4, 4, 6, 4, 8, 6, 8, 4, 8, 8, 12, 6, 12, 8, 10, 3, 6, 6, 9, 6, 12, 9, 12, 4, 8, 8, 12, 5, 10, 6, 7, 2, 4, 4, 6, 4, 8, 6, 8, 4, 8, 8, 12, 6, 12, 8, 10, 4, 8, 8, 12, 8, 16, 12, 16, 6, 12, 12, 18, 8, 16, 10, 12
Offset: 0

Views

Author

Benoit Cloitre, May 15 2005

Keywords

Comments

The formula (the recurrence, if confirmed to be equal to sum binomial formula) implies that this is the run length transform of the sequence 1,2,3,4,5,... - N. J. A. Sloane, Feb 05 2015. Note: That sequence should be considered as a successor function a(n) = n+1, starting from offset 0. See also A020725. - Antti Karttunen, Oct 15 2016
The recurrence formula is correct. See paper in links. - Chai Wah Wu, Oct 16 2016

Crossrefs

Row sums of triangle in A253084.
Cf. A000005, A005940, A020725, A227349, A277335 (positions of odd terms).
Cf. also A153013.

Programs

  • Mathematica
    Table[Sum[Mod[#, 2] &[Binomial[n + k, n - k] Binomial[n, k]], {k, 0, n}], {n, 0, 95}] (* Michael De Vlieger, Oct 17 2016 *)
  • PARI
    a(n) = sum(k=0, n, (binomial(n+k,n-k)*binomial(n,k)) % 2); \\ Michel Marcus, Dec 08 2013
    
  • Python
    def A106737(n):
        return sum(int(not (~(n+k) & (n-k)) | (~n & k)) for k in range(n+1)) # Chai Wah Wu, Feb 09 2016
    (Scheme, two mathematically equal implementations, based on RLT-interpretation)
    ;; The first one implements the given recurrence and uses memoization-macro definec:
    (definec (A106737 n) (cond ((zero? n) 1) ((even? n) (A106737 (/ n 2))) ((= 1 (modulo n 4)) (* 2 (A106737 (/ (- n 1) 2)))) (else (- (* 2 (A106737 (/ (- n 1) 2))) (A106737 (/ (- n 3) 4))))))
    ;; This one applies the Run Length Transform explicitly to r -> r+1 function:
    (define (A106737 n) (fold-left (lambda (a r) (* a (+ 1 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2))))) ;; See A227349 for the required other functions.
    ;; Antti Karttunen, Oct 15 2016

Formula

a(0)=1, a(2n) = a(n), a(4n+1) = 2*a(2n), a(4n+3) = 2*a(2n+1) - a(n).
From Antti Karttunen, Oct 15 2016: (Start)
a(n) = A000005(A005940(1+n)). [Follows from the Run Length Transform-interpretation.]
For n > 1, a(n^2) is always even. [Based on RLT-interpretation. n^2 = 1 modulo 4 for all odd n and ((2^k)*n)^2 = 2^(2k) * (n^2), thus the last 1-bit is always alone and contributes 2 to the product, making it even.]
(End)

A004780 Binary expansion contains 2 adjacent 1's.

Original entry on oeis.org

3, 6, 7, 11, 12, 13, 14, 15, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 70, 71, 75, 76, 77, 78, 79, 83, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
Offset: 1

Views

Author

Keywords

Comments

Complement of A003714. It appears that n is in the sequence if and only if C(3n,n) is even. - Benoit Cloitre, Mar 09 2003
Since the binary representation of these numbers contains two adjacent 1's, so for these values of n, we will have (n XOR 2n XOR 3n) != 0, and thus a two player Nim game with three heaps of (n, 2n, 3n) stones will be a winning configuration for the first player. - V. Raman, Sep 17 2012
A048728(a(n)) > 0. - Reinhard Zumkeller, May 13 2014
The set of numbers x such that Or(x,3*x) <> 3*x. - Gary Detlefs, Jun 04 2024

Crossrefs

Complement: A003714.
Subsequences (apart from any initial zero-term): A001196, A004755, A004767, A033428, A277335.

Programs

  • Haskell
    a004780 n = a004780_list !! (n-1)
    a004780_list = filter ((> 1) . a048728) [1..]
    -- Reinhard Zumkeller, May 13 2014
    
  • Maple
    q:= n-> verify([1$2], Bits[Split](n), 'sublist'):
    select(q, [$0..200])[];  # Alois P. Heinz, Oct 22 2021
  • PARI
    is(n)=bitand(n,n+n)>0 \\ Charles R Greathouse IV, Sep 19 2012
    
  • Python
    from itertools import count, islice
    def A004780_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:n&(n<<1), count(max(startvalue,1)))
    A004780_list = list(islice(A004780_gen(),30)) # Chai Wah Wu, Jul 13 2022

Formula

a(n) ~ n. - Charles R Greathouse IV, Sep 19 2012

Extensions

Offset corrected by Reinhard Zumkeller, Jul 28 2010

A037011 Baum-Sweet cubic sequence.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Memo: more sequences like this should be added to the database.

Crossrefs

Programs

  • Maple
    A := x; for n from 1 to 100 do series(x+x*A^3+O(x^(n+2)),x,n+2); A := series(% mod 2,x,n+2); od: A;
  • Mathematica
    m = 100; A[_] = 0;
    Do[A[x_] = x + x A[x]^3 + O[x]^m // Normal // PolynomialMod[#, 2]&, {m}];
    CoefficientList[A[x], x] // Rest (* Jean-François Alcover, Oct 15 2019 *)

Formula

G.f. satisfies A^3+x^(-1)*A+1 = 0 (mod 2).
It appears that a(n)=sum(k=0, n-1, C(n-1+k, n-1-k)*C(n-1, k)) modulo 2 = A082759(n-1) (mod 2). It appears also that a(k)=1 iff k/3 is in A003714. - Benoit Cloitre, Jun 20 2003
From Antti Karttunen, Nov 03 2017: (Start)
If Cloitre's above observation holds, then we also have (assuming starting offset 0, with a(0) = 1):
a(n) = A000035(A106737(n)).
a(n) = A010052(A005940(1+n)).
(End)

A365808 Numbers k such that A163511(k) is a square.

Original entry on oeis.org

0, 2, 5, 8, 11, 17, 20, 23, 32, 35, 41, 44, 47, 65, 68, 71, 80, 83, 89, 92, 95, 128, 131, 137, 140, 143, 161, 164, 167, 176, 179, 185, 188, 191, 257, 260, 263, 272, 275, 281, 284, 287, 320, 323, 329, 332, 335, 353, 356, 359, 368, 371, 377, 380, 383, 512, 515, 521, 524, 527, 545, 548, 551, 560, 563, 569, 572, 575
Offset: 1

Views

Author

Antti Karttunen, Oct 01 2023

Keywords

Comments

The sequence is defined inductively as:
(a) it contains 0 and 2,
and
(b) for any nonzero term a(n), (2*a(n)) + 1 and 4*a(n) are also included as terms.
Because the inductive definition guarantees that all terms after 0 are of the form 3k+2 (A016789), and because for any n >= 0, n^2 == 0 or 1 (mod 3), (i.e., squares are in A032766), it follows that there are no squares in this sequence after the initial 0.

Crossrefs

Cf. A000290, A010052, A032766, A163511, A365807 (characteristic function).
Positions of even terms in A365805.
Sequence A243071(n^2), n >= 1, sorted into ascending order.
Subsequences: A004171, A055010, A365809 (odd terms).
Subsequence of A016789 (after the initial 0).

Programs

  • PARI
    A163511(n) = if(!n, 1, my(p=2, t=1); while(n>1, if(!(n%2), (t*=p), p=nextprime(1+p)); n >>= 1); (t*p));
    isA365808v2(n) = issquare(A163511(n));
    
  • PARI
    isA365808(n) = if(n<=2, !(n%2), if(n%2, isA365808((n-1)/2), if(n%4, 0, isA365808(n/4))));
    
  • Python
    from itertools import count, islice
    def A365808_gen(): # generator of terms
        return map(lambda n:(3*(n+1)>>2)-1,filter(lambda n:n==1 or (n&3==3 and not '00' in bin(n)),count(1)))
    A365808_list = list(islice(A365808_gen(),20)) # Chai Wah Wu, Feb 12 2025

A088698 Replace 1 with 11 in binary representation of n.

Original entry on oeis.org

0, 3, 6, 15, 12, 27, 30, 63, 24, 51, 54, 111, 60, 123, 126, 255, 48, 99, 102, 207, 108, 219, 222, 447, 120, 243, 246, 495, 252, 507, 510, 1023, 96, 195, 198, 399, 204, 411, 414, 831, 216, 435, 438, 879, 444, 891, 894, 1791, 240, 483, 486, 975, 492, 987, 990
Offset: 0

Views

Author

Ralf Stephan, Oct 07 2003

Keywords

Examples

			n=9: 1001 -> 110011 = 51, so a(9) = 51.
		

Crossrefs

Ordered terms plus one are in A048297.
Same sequence sorted into ascending order: A277335, A290258 (without 0).
Main diagonal of A341520, right edge of A341521.

Programs

  • PARI
    a(n)=if(n<1,0,if(n%2==0,2*a(n/2),4*a((n-1)/2)+3))
    
  • Python
    def a(n): return int(bin(n)[2:].replace('1', '11'), 2)
    print([a(n) for n in range(55)]) # Michael S. Branicky, Feb 20 2021

Formula

a(0)=0, a(2n) = 2a(n), a(2n+1) = 4a(n) + 3.

A290258 Triangle read by rows: row n (>=2) contains in increasing order the integers for which the binary representation has length n and all runs of 1's have even length.

Original entry on oeis.org

3, 6, 12, 15, 24, 27, 30, 48, 51, 54, 60, 63, 96, 99, 102, 108, 111, 120, 123, 126, 192, 195, 198, 204, 207, 216, 219, 222, 240, 243, 246, 252, 255, 384, 387, 390, 396, 399, 408, 411, 414, 432, 435, 438, 444, 447, 480, 483, 486, 492, 495, 504, 507, 510
Offset: 2

Views

Author

Emeric Deutsch, Sep 12 2017

Keywords

Comments

The viabin numbers of integer partitions having only even parts. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [6,4,4,2]. The southeast border of its Ferrers board yields 110110011 (length is 9), leading to the viabin number 435 (a term in row 9).
Number of entries in row n is the Fibonacci number F(n-1) = A000045(n-1).
T(n,k) = A290259(n-1,k) + 2^(n-1).
Last entry in row n = A141023(n).
Basically the same as A277335.

Examples

			399 is in the sequence because all the runs of 1's of its binary representation, namely 110001111, have even lengths.
Triangle begins:
  3;
  6;
  12,15;
  24,27,30;
  48,51,54,60,63;
  96,99,102,108,111,120,123,126;
  ...
		

Crossrefs

Programs

  • Maple
    A[2] := {3}; A[3] := {6}; for n from 4 to 10 do A[n] := `union`(map(proc (x) 2*x end proc, A[n-1]), map(proc (x) 4*x+3 end proc, A[n-2])) end do; # yields sequence in triangular form
  • Mathematica
    A[2] = {3}; A[3] = {6};
    For[n = 4, n <= 10, n++, A[n] = Union[2 A[n-1], 4 A[n-2] + 3]];
    Table[A[n], {n, 2, 10}] // Flatten (* Jean-François Alcover, Aug 19 2024, after Maple program *)

Formula

The entries in row n (n>=4) are: (i) 2x, where x is in row n-1 and (ii) 4y + 3, where y is in row n-2. The Maple program is based on this.

A295897 Numbers in whose binary expansion there are no 1-runs of odd length followed by a 0 to their right.

Original entry on oeis.org

0, 1, 3, 6, 7, 12, 13, 15, 24, 25, 27, 30, 31, 48, 49, 51, 54, 55, 60, 61, 63, 96, 97, 99, 102, 103, 108, 109, 111, 120, 121, 123, 126, 127, 192, 193, 195, 198, 199, 204, 205, 207, 216, 217, 219, 222, 223, 240, 241, 243, 246, 247, 252, 253, 255, 384, 385, 387, 390, 391, 396, 397, 399, 408, 409, 411, 414, 415, 432
Offset: 1

Views

Author

Antti Karttunen, Dec 01 2017

Keywords

Comments

No runs of 1-bits of odd length allowed in the binary expansion of n (A007088), except that when n is an odd number, then the rightmost run may have an odd length. Subsequence A277335 does not allow that exception.
A005940(1+a(n)) yields a permutation of A028982, squares and twice squares.
Running maximum without repetition of the decimal equivalent of Gray code for n (A003188). - Frédéric Nouvier, Aug 14 2020

Crossrefs

Subsequence of A004760.
Cf. A277335 (a subsequence).
Cf. A295896 (characteristic function).

Programs

  • Python
    [x ^ (x>>1) for x in range(0,2048) if (x & (x<<1) == 0)]
    # Frédéric Nouvier, Aug 14 2020
    
  • Python
    def A295897(n):
        tlist, s = [1,2], 0
        while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
        for d in tlist[::-1]:
            s <<= 1
            if d <= n:
                s += 1
                n -= d
        return s>>1^s # Chai Wah Wu, Apr 25 2025
  • Rust
    fn main() {
        for i in (0..2048)
            // Filter to get A003714
            .filter(|n| n & (n << 1) == 0)
            // Map to produce A295897
            .map(|n| n ^ (n >> 1))
        {
            println!("{}", i);
        }
    } // Frédéric Nouvier, Aug 14 2020
    

Formula

a(n) = A003714(n-1) XOR ( A003714(n-1) >> 1 ). - Frédéric Nouvier, Aug 14 2020

A346705 The a(n)-th composition in standard order is the even bisection of the n-th composition in standard order.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 4, 2, 1, 3, 0, 1, 2, 1, 4, 2, 1, 3, 8, 4, 2, 5, 1, 3, 6, 3, 0, 1, 2, 1, 4, 2, 1, 3, 8, 4, 2, 5, 1, 3, 6, 3, 16, 8, 4, 9, 2, 5, 10, 5, 1, 3, 6, 3, 12, 6, 3, 7, 0, 1, 2, 1, 4, 2, 1, 3, 8, 4, 2, 5, 1, 3, 6, 3, 16, 8, 4, 9, 2, 5
Offset: 0

Views

Author

Gus Wiseman, Aug 19 2021

Keywords

Comments

The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again.
a(n) is the row number in A066099 of the even bisection (even-indexed terms) of the n-th row of A066099.

Examples

			Composition number 741 in standard order is (2,1,1,3,2,1), with even bisection (1,3,1), which is composition number 25 in standard order, so a(741) = 25.
		

Crossrefs

Length of the a(n)-th standard composition is A000120(n)/2 rounded down.
Positions of first appearances appear to be A088698, sorted: A277335.
The version for reversed prime indices appears to be A329888, sums A346700.
Sum of the a(n)-th standard composition is A346633.
An unordered reverse version for odd bisection is A346701, sums A346699.
The version for odd bisection is A346702, sums A209281(n+1).
An unordered version for odd bisection is A346703, sums A346697.
An unordered version is A346704, sums A346698.
A011782 counts compositions.
A029837 gives length of binary expansion, or sometimes A070939.
A066099 lists compositions in standard order.
A097805 counts compositions by alternating sum.

Programs

  • Mathematica
    Table[Total[2^Accumulate[Reverse[Last/@Partition[ Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse,2]]]]/2,{n,0,100}]

Formula

A029837(a(n)) = A346633(n).
Showing 1-8 of 8 results.