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

A006047 Number of entries in n-th row of Pascal's triangle not divisible by 3.

Original entry on oeis.org

1, 2, 3, 2, 4, 6, 3, 6, 9, 2, 4, 6, 4, 8, 12, 6, 12, 18, 3, 6, 9, 6, 12, 18, 9, 18, 27, 2, 4, 6, 4, 8, 12, 6, 12, 18, 4, 8, 12, 8, 16, 24, 12, 24, 36, 6, 12, 18, 12, 24, 36, 18, 36, 54, 3, 6, 9, 6, 12, 18, 9, 18, 27, 6, 12, 18, 12, 24, 36, 18, 36, 54, 9, 18, 27, 18, 36, 54, 27, 54
Offset: 0

Views

Author

Keywords

Comments

Fixed point of the morphism a -> a, 2a, 3a, starting from a(1) = 1. - Robert G. Wilson v, Jan 24 2006
This is a particular case of the number of entries in n-th row of Pascal's triangle not divisible by a prime p, which is given by a simple recursion using ⊗, the Kronecker (or tensor) product of vectors. Let v_0=(1,2,...,p). Then v_{n+1}=v_0 ⊗ v_n, where the vector v_n contains the values for the first p^n rows of Pascal's triangle (rows 0 through p^n-1). - William B. Everett (bill(AT)chgnet.ru), Mar 29 2008
a(n) = A206424(n) + A227428(n); number of nonzero terms in row n of triangle A083093. - Reinhard Zumkeller, Jul 11 2013

Examples

			15 in base 3 is 120, here r=1 and s=1 so a(15) = 3*2 = 6.
William B. Everett's comment with p=3, n=2: v_0 = (1,2,3), v_1 = (1,2,3) => v_2 = (1*1,1*2,1*3,2*1,2*2,2*3,3*1,3*2,3*3) = (1,2,3,2,4,6,3,6,9), the first 3^2 values of the present sequence. - _Wolfdieter Lang_, Mar 19 2014
		

References

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

Crossrefs

Programs

  • Haskell
    a006047 = sum . map signum . a083093_row
    -- Reinhard Zumkeller, Jul 11 2013
    
  • Maple
    p:=proc(n) local ct, k: ct:=0: for k from 0 to n do if binomial(n,k) mod 3 = 0 then else ct:=ct+1 fi od: end: seq(p(n),n=0..82); # Emeric Deutsch
    f:= proc(n) option remember; ((n mod 3)+1)*procname(ceil((n+1)/3)-1) end proc:
    f(0):= 1: f(1):= 2:
    seq(f(i), i=0..100); # Robert Israel, Oct 15 2015
  • Mathematica
    Nest[Flatten[ # /. a_Integer -> {a, 2a, 3a}] &, {1}, 4] (* Robert G. Wilson v, Jan 24 2006 *)
    Nest[ Join[#, 2#, 3#] &, {1}, 4] (* Robert G. Wilson v, Jul 27 2014 *)
  • PARI
    b(n)=if(n<3,n,if(n%3==0,3*b(n/3),if(n%3==1,1*b((n+2)/3),2*b((n+1)/3)))) \\ Ralf Stephan
    
  • PARI
    A006047(n) = b(1+n); \\ (The above PARI-program by Ralf Stephan is for offset-1-version of this sequence.) - Antti Karttunen, May 28 2017
    
  • PARI
    A006047(n) = { my(m=1, d); while(n, d = (n%3); m *= (1+d); n \= 3); m; }; \\ Antti Karttunen, May 28 2017
    
  • PARI
    a(n) = prod(i=1,#d=digits(n, 3), (1+d[i])) \\ David A. Corneth, May 28 2017
    
  • PARI
    upto(n) = my(res = [1], v); while(#res < n, v = concat(2*res, 3*res); res = concat(res, v)); res \\ David A. Corneth, May 29 2017
    
  • Python
    from sympy.ntheory.factor_ import digits
    from sympy import prod
    def a(n):
        d=digits(n, 3)
        return n + 1 if n<3 else prod(1 + d[i] for i in range(1, len(d)))
    print([a(n) for n in range(51)]) # Indranil Ghosh, Jun 06 2017
    
  • Python
    from sympy.ntheory import digits
    def A006047(n): return 3**(s:=digits(n,3)).count(2)<Chai Wah Wu, Apr 24 2025
  • Scheme
    (define (A006047 n) (if (zero? n) 1 (let ((d (mod n 3))) (* (+ 1 d) (A006047 (/ (- n d) 3)))))) ;; For R6RS standard. Use modulo instead of mod in older Schemes like MIT/GNU Scheme. - Antti Karttunen, May 28 2017
    

Formula

Write n in base 3; if the representation contains r 1's and s 2's then a(n) = 3^s * 2^r. Also a(n) = Sum_{k=0..n} (C(n, k)^2 mod 3). - Avi Peretz (njk(AT)netvision.net.il), Apr 21 2001
a(n) = b(n+1), with b(1)=1, b(2)=2, b(3n)=3b(n), b(3n+1)=b(n+1), b(3n+2)=2b(n+1). - Ralf Stephan, Sep 15 2003
G.f.: Product_{n>=0} (1+2*x^(3^n)+3*x^(2*3^n)) (Northshield). - Johannes W. Meijer, Jun 05 2011
G.f. g(x) satisfies g(x) = (1 + 2*x + 3*x^2)*g(x^3). - Robert Israel, Oct 15 2015
From Tom Edgar, Oct 15 2015: (Start)
a(3^k) = 2 for k>=0;
a(2*3^k) = 3 for k>=0;
a(n) = Product_{b_j != 0} a(b_j*3^j) where n = Sum_{j>=0} b_j*3^j is the ternary representation of n. (End)
A056239(a(n)) = A053735(n). - Antti Karttunen, Jun 03 2017
a(n) = Sum_{k = 0..n} mod(C(n,k)^2, 3). - Peter Bala, Dec 17 2020

Extensions

More terms from Ralf Stephan, Sep 15 2003

A291759 Binary encoding of 2-digits in ternary representation of A048673(n).

Original entry on oeis.org

0, 1, 0, 1, 0, 3, 2, 1, 0, 1, 2, 5, 0, 3, 4, 1, 0, 1, 0, 1, 0, 5, 2, 9, 6, 7, 8, 5, 2, 7, 4, 1, 2, 1, 0, 1, 4, 3, 2, 1, 4, 1, 6, 9, 2, 3, 0, 17, 10, 13, 4, 13, 0, 23, 4, 9, 8, 5, 0, 13, 2, 9, 8, 1, 10, 3, 0, 1, 12, 3, 0, 1, 0, 11, 2, 5, 12, 5, 2, 1, 10, 9, 4, 1, 8, 11, 14, 17, 4, 5, 0, 5, 0, 15, 0, 33, 6, 21, 16, 25, 6, 11, 8, 25, 16, 3, 8, 45, 8, 9, 4, 17, 8
Offset: 1

Views

Author

Antti Karttunen, Sep 12 2017

Keywords

Crossrefs

Formula

a(n) = A289814(A048673(n)).

A286585 a(n) = A053735(A048673(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from sympy import factorint, nextprime
    from operator import mul
    def a053735(n): return sum(digits(n, 3)[1:])
    def a048673(n):
        f = factorint(n)
        return 1 if n==1 else (1 + reduce(mul, [nextprime(i)**f[i] for i in f]))//2
    def a(n): return a053735(a048673(n))
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286585 n) (A053735 (A048673 n)))
    

Formula

a(n) = A053735(A048673(n)).
For all n >= 0, a(A000079(n)) = n+1.

A286633 Base-3 {digit+1} product of A254103: a(n) = A006047(A254103(n)).

Original entry on oeis.org

1, 2, 3, 2, 6, 4, 9, 3, 12, 2, 6, 6, 18, 8, 18, 4, 24, 12, 27, 6, 12, 3, 9, 4, 36, 4, 12, 6, 36, 2, 6, 12, 48, 6, 18, 12, 54, 16, 36, 9, 24, 24, 54, 4, 18, 8, 18, 6, 72, 24, 54, 6, 24, 12, 27, 6, 72, 36, 81, 12, 12, 6, 18, 18, 96, 36, 81, 12, 36, 6, 18, 36, 108, 8, 24, 18, 72, 24, 54, 8, 48, 12, 36, 18, 108, 2, 6, 24, 36, 4, 12, 12, 36, 3, 9, 4
Offset: 0

Views

Author

Antti Karttunen, Jun 03 2017

Keywords

Comments

Reflecting the structure of A254103 also this sequence can be represented as a binary tree:
1
|
...................2...................
3 2
6......../ \........4 9......../ \........3
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
12 2 6 6 18 8 18 4
24 12 27 6 12 3 9 4 36 4 12 6 36 2 6 12
etc.

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from operator import mul
    from functools import reduce
    def a006047(n):
        d=digits(n, 3)
        return reduce(mul, [1 + d[i] for i in range(1, len(d))])
    def a254103(n):
        if n==0: return 0
        if n%2==0: return 3*a254103(n//2) - 1
        else: return (3*(1 + a254103((n - 1)//2)))//2
    def a(n): return a006047(a254103(n)) # Indranil Ghosh, Jun 06 2017
  • Scheme
    (define (A286633 n) (A006047 (A254103 n)))
    

Formula

a(n) = A006047(A254103(n)).
For n >= 0, a(A000079(n)) = A042950(n).

A286587 a(n) = A006047(A244154(n)).

Original entry on oeis.org

2, 3, 2, 6, 4, 9, 8, 12, 3, 6, 3, 18, 18, 12, 6, 24, 6, 18, 4, 12, 8, 54, 12, 36, 18, 27, 24, 24, 12, 81, 72, 48, 2, 9, 6, 36, 12, 6, 12, 24, 9, 36, 24, 108, 4, 18, 36, 72, 8, 27, 18, 54, 36, 144, 72, 48, 27, 18, 48, 162, 288, 108, 54, 96, 4, 27, 24, 18, 9, 36, 6, 72, 16, 18, 36, 12, 72, 54, 144, 48, 8, 162, 48, 72, 18, 36, 54, 216, 24
Offset: 0

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A006047(A244154(n)).
a(n) = A286586(A005940(1+n)).
For n >= 0, a(A000225(n)) = A042950(n).

A340383 Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j), where f(n) = [A278222(A304759(n)), A278222(A291759(n))], for all i, j >= 1.

Original entry on oeis.org

1, 2, 1, 3, 4, 5, 2, 6, 7, 3, 3, 8, 1, 9, 2, 10, 11, 6, 4, 12, 11, 13, 3, 14, 9, 15, 3, 16, 12, 17, 3, 18, 3, 3, 7, 19, 3, 9, 19, 19, 6, 3, 5, 8, 12, 20, 1, 21, 8, 22, 12, 23, 11, 24, 12, 25, 6, 8, 26, 27, 12, 13, 12, 28, 13, 29, 4, 12, 9, 20, 26, 30, 31, 22, 10, 16, 5, 14, 6, 32, 33, 8, 3, 12, 10, 23, 15, 14, 19, 8
Offset: 1

Views

Author

Antti Karttunen, Jan 16 2021

Keywords

Comments

Restricted growth sequence transform of the ordered pair [A340381(n), A340382(n)], or equally, of the function f(n) = A290093(A048673(n)).
For all i, j: a(i) = a(j) => A286586(i) = A286586(j) => A286585(i) = A286585(j).

Crossrefs

Programs

  • PARI
    up_to = 65537;
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961
    A048673(n) = (A003961(n)+1)/2;
    A289814(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From A289814
    A291759(n) = A289814(A048673(n));
    A289813(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2); } \\ From A289813
    A304759(n) = A289813(A048673(n));
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    A278222(n) = A046523(A005940(1+n));
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    Aux340383(n) = [A278222(A291759(n)),A278222(A304759(n))];
    v340383 = rgs_transform(vector(up_to,n,Aux340383(n)));
    A340383(n) = v340383[n];

A289623 a(n) = A055396(A048673(n)).

Original entry on oeis.org

0, 1, 2, 3, 1, 1, 1, 1, 6, 5, 4, 9, 2, 7, 1, 13, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 2, 1, 1, 16, 8, 1, 2, 10, 2, 30, 2, 3, 14, 3, 1, 23, 1, 17, 1, 1, 2, 4, 18, 1, 1, 4, 1, 1, 1, 35, 1, 15, 11, 1, 1, 1, 1, 3, 1, 1, 1, 1, 21, 1, 12, 1, 1, 1, 2, 1, 1, 1, 1, 1, 65, 3, 2, 1, 19, 20, 1, 1, 4, 56, 1, 32, 2, 1, 2, 1, 2, 1, 38, 6
Offset: 1

Views

Author

Antti Karttunen, Jul 16 2017

Keywords

Comments

From the scatter plot it can be seen that the terms are grouped into two distinct populations by their magnitude, with significant gap between them.

Crossrefs

Cf. A048673, A055396, A246263 (the positions of ones).

Programs

Formula

a(n) = A055396(A048673(n)).
Showing 1-7 of 7 results.