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

A014312 Numbers with exactly 4 ones in binary expansion.

Original entry on oeis.org

15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 71, 75, 77, 78, 83, 85, 86, 89, 90, 92, 99, 101, 102, 105, 106, 108, 113, 114, 116, 120, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 177, 178, 180, 184, 195, 197
Offset: 1

Views

Author

Al Black (gblack(AT)nol.net)

Keywords

Crossrefs

Cf. A090706.
Cf. A000079, A018900, A014311, A014313, A023688, A023689, A023690, A023691 (Hamming weight = 1, 2, ..., 9), A057168.

Programs

  • Mathematica
    Select[ Range[ 180 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==4)& ] (* Olivier Gérard *)
  • PARI
    for(n=0,10^3,if(hammingweight(n)==4,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    print1(t=15); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Perl
    $N = 4;
    my $vector = 2 ** $N - 1;  # first key (15)
    for (1..100) {
      print "$vector, ";
      my ($v, $d) = ($vector, 0);
      until ($v & 1 or !$v) { $d = ($d << 1)|1; $v >>= 1 }
      $vector += $d + 1 + (($v ^ ($v + 1)) >> 2);  # next key
    } # Ruud H.G. van Tol, Mar 02 2014
    
  • Python
    A014312_list = [2**a+2**b+2**c+2**d for a in range(3,6) for b in range(2,a) for c in range(1,b) for d in range(c)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from itertools import islice
    def A014312_gen(): # generator of terms
        yield (n:=15)
        while True: yield (n:=n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A014312_list = list(islice(A014312_gen(),20)) # Chai Wah Wu, Mar 10 2025
    
  • Rust
    pub const fn next_choice(value: usize) -> usize {
      // Passing a term will return the next number in the sequence
      let zeros = value.trailing_zeros();
      let ones = (value >> zeros).trailing_ones();
      value + (1 << zeros) + (1 << (ones - 1)) - 1
    } // Andrew Bennett, Jan 07 2022

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
a(n) = 2^A194882(n-1) + 2^A194883(n-1) + 2^A194884(n-1) + 2^A127324(n-1). - Ridouane Oudra, Sep 06 2020
Sum_{n>=1} 1/a(n) = 1.399770961748474333075618147113153558623203796657745865012742162098738541849... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

Extensions

Extension by Olivier Gérard

A127324 Fourth 4-dimensional hyper-tetrahedral coordinate; 4-D analog of A056558.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 2, 0, 0, 0, 1, 0, 0, 1, 0, 1, 2, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 0, 0, 1, 0, 0, 1, 0, 1, 2, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, 0, 0, 1, 0, 0, 1, 0, 1, 2, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4
Offset: 0

Views

Author

Graeme McRae, Jan 10 2007

Keywords

Comments

Alternatively, write n = C(i,4)+C(j,3)+C(k,2)+C(l,1) with i>j>k>l>=0; sequence gives k values. Each n >= 0 has a unique representation as n = C(i,4)+C(j,3)+C(k,2)+C(l.1) with i>j>k>l>=0. This is the combinatorial number system of degree t = 4, where we get [A194882, A194883, A194884, A127324].
If {(W,X,Y,Z)} are 4-tuples of nonnegative integers with W>=X>=Y>=Z ordered by W, X, Y and Z, then W=A127321(n), X=A127322(n), Y=A127323(n) and Z=A127324(n). These sequences are the four-dimensional analogs of the three-dimensional A056556, A056557 and A056558.
This is a 'Matryoshka doll' sequence with alpha=0 (cf. A055462 and A000332), seq(seq(seq(seq(i,i=alpha..k),k=alpha..n),n=alpha..m),m=alpha..4). - Peter Luschny, Jul 14 2009

Examples

			See A127321 for a table of A127321, A127322, A127323, A127324
See A127327 for a table of A127324, A127325, A127326, A127327
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.

Crossrefs

Programs

  • Haskell
    import Data.List (inits)
    a127324 n = a127324_list !! n
    a127324_list = concatMap (concatMap concat .
                   inits . inits . enumFromTo 0) $ enumFrom 0
    -- Reinhard Zumkeller, Jun 01 2015
  • Maple
    seq(seq(seq(seq(i,i=0..k),k=0..n),n=0..m),m=0..5); # Peter Luschny, Sep 22 2011
  • Mathematica
    Table[i, {m, 0, 5}, {k, 0, m}, {j, 0, k}, {i, 0, j}] // Flatten  (* Robert G. Wilson v, Sep 27 2011 *)

Formula

For W>=X>=Y>=Z>=0, a(A000332(W+3)+A000292(X)+A000217(Y)+Z) = Z A127322(n+1) = A127321(n)==A127324(n) ? 0 : A127322(n)==A127324(n) ? 0 : A127323(n)==A127324(n) ? 0 : A127324(n)+1

A194882 Write n = C(i,4)+C(j,3)+C(k,2)+C(l,1) with i>j>k>l>=0; sequence gives i values.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 04 2011

Keywords

Comments

Each n >= 0 has a unique representation as n = C(i,4)+C(j,3)+C(k,2)+C(l.1) with i>j>k>l>=0. This is the combinatorial number system of degree t = 4, where we get [A194882, A194883, A194884, A127324]. For degree t = 3 see A194847.

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.

Crossrefs

Programs

  • Python
    from math import comb
    from sympy import integer_nthroot
    def A194882(n): return (m:=integer_nthroot(24*(n+2),4)[0]+1)+(n>=comb(m+1,4)) # Chai Wah Wu, Dec 10 2024

Formula

a(n) = m if n < binomial(m+1,4) and a(n) = m+1 otherwise where m = 1+floor((24*(n+2))^(1/4)). - Chai Wah Wu, Dec 10 2024

A194883 Write n = C(i,4)+C(j,3)+C(k,2)+C(l,1) with i>j>k>l>=0; sequence gives j values.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 04 2011

Keywords

Comments

Each n >= 0 has a unique representation as n = C(i,4)+C(j,3)+C(k,2)+C(l.1) with i>j>k>l>=0. This is the combinatorial number system of degree t = 4, where we get [A194882, A194883, A194884, A127324]. For degree t = 3 see A194847.

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.

Crossrefs

A194885 Write n = C(i,4)+C(j,3)+C(k,2)+C(l,1) with i>j>k>l>=0; let L[n] = [i,j,k,l]; sequence gives list of quadruples L[n], n >= 0.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 04 2011

Keywords

Comments

Each n >= 0 has a unique representation as n = C(i,4)+C(j,3)+C(k,2)+C(l.1) with i>j>k>l>=0. This is the combinatorial number system of degree t = 4, where we get [A194882, A194883, A194884, A127324]. For degree t = 3 see A194847.

Examples

			List of quadruples begins:
[3, 2, 1, 0]
[4, 2, 1, 0]
[4, 3, 1, 0]
[4, 3, 2, 0]
[4, 3, 2, 1]
[5, 2, 1, 0]
[5, 3, 1, 0]
[5, 3, 2, 0]
[5, 3, 2, 1]
[5, 4, 1, 0]
[5, 4, 2, 0]
...
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.

Crossrefs

The four columns are [A194882, A194883, A194885, A127324], or equivalently [A127321+3, A127322+2, A127323+1, A127324].
Showing 1-5 of 5 results.