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.

A051382 Numbers k whose base 3 expansion matches (0|1)*(02)?(0|1)* (no more than one "02" allowed in midst of 0's and 1's).

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 18, 19, 21, 22, 27, 28, 29, 30, 31, 33, 34, 36, 37, 38, 39, 40, 54, 55, 57, 58, 63, 64, 66, 67, 81, 82, 83, 84, 85, 87, 88, 90, 91, 92, 93, 94, 99, 100, 102, 103, 108, 109, 110, 111, 112, 114, 115, 117, 118, 119, 120, 121, 162, 163
Offset: 1

Views

Author

Keywords

Comments

Representation of 2n in base 3 consists entirely of 0's and 2's, except possibly for a single pair of adjacent 1's among them.
9 divides neither C(2s-1,s) [= A001700(s)] nor C(2s,s) [= A000984(s)] if and only if s = a(n). [Cf. also A249721].

Examples

			In base 3 the terms look like 0, 1, 2, 10, 11, 20, 21, 100, 101, 102, 110, 111, 200, 201, 210, 211, 1000, 1001, 1002, 1010, 1011, 1020, 1021, 1100, 1101, 1102, 1110, 1111, 2000, 2001, 2010, 2011, 2100, 2101, 2 110, 2111, 10000
		

Crossrefs

Complement: A249719.
Terms of A249721 halved.

Programs

  • Maple
    q:= n-> (l-> (h-> h=0 or h=1 and l[1+ListTools[Search](2, l)]
              =0 )(numboccur(l, 2)))([convert(n, base, 3)[], 0]):
    select(q, [$0..163])[];  # Alois P. Heinz, Jun 28 2021
  • PARI
    is(n)=my(v=digits(n,3)); for(i=1,#v, if(v[i]==2, if(i>1 && v[i-1], return(0)); for(j=i+1,#v, if(v[j]==2, return(0))); return(1))); 1 \\ Charles R Greathouse IV, Feb 23 2024
  • Perl
    sub conv_x_base_n { my($x, $b) = @_; my ($r, $z) = (0, ''); do { $r = $x % $b; $x = ($x - $r)/$b; $z = "$r" . $z; } while(0 != $x); return($z); }
    
  • Perl
    for($i=1; $i <= 201; $i++) { if(("0" . conv_x_base_n($i, 3)) =~ /^(0|1)*(02)?(0|1)*$/) { print $i, ", "; } }
    (Scheme, with Antti Karttunen's IntSeq-library)
    (define A051382 (MATCHING-POS 0 0 in_A051382?))
    (define (in_A051382? n) (let loop ((n n) (seen02yet? #f)) (cond ((zero? n) #t) ((= 1 n) #t) ((modulo n 3) => (lambda (r) (cond ((= r 2) (if (or seen02yet? (not (zero? (modulo (/ (- n r) 3) 3)))) #f (loop (/ (- n r) 3) #t))) (else (loop (/ (- n r) 3) seen02yet?))))))))
    
  • Python
    import re
    from sympy.ntheory.digits import digits
    def b3(n): return "".join(map(str, digits(n, 3)[1:]))
    def ok(n): return re.fullmatch('2(0|1)*|(0|1)*(02)?(0|1)*', b3(n)) != None
    print(list(filter(ok, range(164)))) # Michael S. Branicky, Jun 26 2021
    

Extensions

a(0) = 0 prepended as a border-line case by Antti Karttunen, Nov 14 2014
Offset changed to 1 by Georg Fischer, Jun 28 2021

A249733 Number of (not necessarily distinct) multiples of 9 on row n of Pascal's triangle.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0, 4, 2, 0, 2, 1, 0, 12, 6, 0, 8, 4, 0, 4, 2, 0, 24, 21, 18, 19, 14, 9, 14, 7, 0, 28, 20, 12, 20, 13, 6, 12, 6, 0, 32, 19, 6, 21, 12, 3, 10, 5, 0, 48, 42, 36, 38, 28, 18, 28, 14, 0, 50, 37, 24, 36, 24, 12, 22, 11, 0, 52, 32, 12, 34, 20, 6, 16, 8, 0
Offset: 0

Views

Author

Antti Karttunen, Nov 04 2014

Keywords

Comments

Number of zeros on row n of A095143 (Pascal's triangle reduced modulo 9).
This should have a formula. See for example A062296, A006047 and A048967.

Examples

			Row 9 of Pascal's triangle is {1, 9, 36, 84, 126, 126, 84, 36, 9, 1}. The terms 9, 36, and 126 are the only multiples of nine, and each of them occurs two times on that row, thus a(9) = 2*3 = 6.
Row 10 of Pascal's triangle is {1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1}. The terms 45 (= 9*5) and 252 (= 9*28) are the only multiples of nine, and the former occurs twice, while the latter is alone at the center, thus a(10) = 2+1 = 3.
		

Crossrefs

Programs

  • Mathematica
    Total/@Table[If[Mod[Binomial[n,k],9]==0,1,0],{n,0,80},{k,0,n}] (* Harvey P. Dale, Feb 12 2020 *)
  • PARI
    A249733(n) = { my(c=0); for(k=0,n\2,if(!(binomial(n,k)%9),c += (if(k<(n/2),2,1)))); return(c); } \\ Unoptimized.
    for(n=0, 6561, write("b249733.txt", n, " ", A249733(n)));
    
  • Python
    import re
    from gmpy2 import digits
    def A249733(n):
        s = digits(n,3)
        n1 = s.count('1')
        n2 = s.count('2')
        n01 = s.count('10')
        n02 = s.count('20')
        n11 = len(re.findall('(?=11)',s))
        n12 = s.count('21')
        return n+1-(((3*(n01+1)+(n02<<2)+n12<<2)+3*n11)*(3**n2<Chai Wah Wu, Jul 24 2025

Formula

For all n >= 0, the following holds:
a(n) <= A048277(n).
a(n) <= A062296(n).
a(2*A249719(n)) > 0 and a((2*A249719(n))-1) > 0.
a(n) is odd if and only if n is one of the terms of A249720.

A249719 Complement of A051382.

Original entry on oeis.org

5, 8, 14, 15, 16, 17, 20, 23, 24, 25, 26, 32, 35, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 59, 60, 61, 62, 65, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 86, 89, 95, 96, 97, 98, 101, 104, 105, 106, 107, 113, 116, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131
Offset: 1

Views

Author

Antti Karttunen, Nov 05 2014

Keywords

Comments

Numbers n whose base 3 expansion does not match (0|1)*(02)?(0|1)*

Crossrefs

Complement: A051382.
Terms of A249720 halved.

A249721 Numbers whose base-3 representation consists entirely of 0's and 2's, except possibly for a single pair of adjacent 1's among them.

Original entry on oeis.org

0, 2, 4, 6, 8, 12, 14, 18, 20, 22, 24, 26, 36, 38, 42, 44, 54, 56, 58, 60, 62, 66, 68, 72, 74, 76, 78, 80, 108, 110, 114, 116, 126, 128, 132, 134, 162, 164, 166, 168, 170, 174, 176, 180, 182, 184, 186, 188, 198, 200, 204, 206, 216, 218, 220, 222, 224, 228, 230, 234, 236, 238, 240, 242, 324
Offset: 0

Views

Author

Antti Karttunen, Nov 14 2014

Keywords

Comments

9 divides neither C(s-1,s/2) (= A001700(s/2)) nor C(s,s/2) (= A000984(s/2)) if and only if s = a(n).

Examples

			   2, which in base 3 is also '2', satisfies the condition, thus it is included;
   4, which in base 3 is  '11', is included;
   6, which in base 3 is  '20', is included;
   8, which in base 3 is  '22', is included;
  12, which in base 3 is '110', is included;
  14, which in base 3 is '112', is included;
however, e.g., 13, 40, and 130, whose ternary representations are '111', '1111' and '11211' respectively, are not included, because they all contain more than one pair of 1's.
		

Crossrefs

Formula

a(n) = 2 * A051382(n).

A323828 Decimal expansion of a constant related to Bertrand's Postulate.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Feb 01 2019

Keywords

Examples

			3.5679760909846634612366007737192526425527943028977913311170116688989193092...
		

Crossrefs

Programs

  • Maple
    evalf(Sum((2^(k-1) + 1)/Product(2^(i-1) + 2, i=1..k-1), k=1..infinity), 120); # Vaclav Kotesovec, Jun 04 2019
  • Sage
    def g(n):
        return sum((2^(k-1) + 1)/prod(2^(i-1) + 2 for i in (1..k-1))
                   for k in (1..n))
    N(g(100), digits=102) # Freddy Barrera, Feb 17 2019

Formula

Sum_{k>=1} (2^(k-1) + 1)/(Product_{i=1..k-1} 2^(i-1) + 2). See Dylan Fridman et al. reference. - Freddy Barrera, Feb 17 2019

Extensions

More terms from Freddy Barrera, Feb 17 2019
Showing 1-5 of 5 results.