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

A053735 Sum of digits of (n written in base 3).

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Comments

Also the fixed point of the morphism 0->{0,1,2}, 1->{1,2,3}, 2->{2,3,4}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20) = 2 + 0 + 2 = 4 because 20 is written as 202 base 3.
From _Omar E. Pol_, Feb 20 2010: (Start)
This can be written as a triangle with row lengths A025192 (see the example in the entry A000120):
0,
1,2,
1,2,3,2,3,4,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,2,3,4,3,4,5,4,5,6,3,...
where the k-th row contains a(3^k+i) for 0<=i<2*3^k and converges to A173523 as k->infinity. (End) [Changed conjectures to statements in this entry. - _Franklin T. Adams-Watters_, Jul 02 2015]
G.f. = x + 2*x^2 + x^3 + 2*x^4 + 3*x^5 + 2*x^6 + 3*x^7 + 4*x^8 + x^9 + 2*x^10 + ...
		

Crossrefs

Cf. A065363, A007089, A173523. See A134451 for iterations.
Sum of digits of n written in bases 2-16: A000120, this sequence, A053737, A053824, A053827, A053828, A053829, A053830, A007953, A053831, A053832, A053833, A053834, A053835, A053836.
Related base-3 sequences: A006047, A230641, A230642, A230643, A230853, A230854, A230855, A230856, A230639, A230640, A010063 (trajectory of 1), A286585, A286632, A289813, A289814.

Programs

  • Haskell
    a053735 = sum . a030341_row
    -- Reinhard Zumkeller, Feb 21 2013, Feb 19 2012
    
  • MATLAB
    m=1; for u=0:104; sol(m)=sum(dec2base(u,3)-'0'); m=m+1;end
    sol; % Marius A. Burtea, Jan 17 2019
  • Magma
    [&+Intseq(n,3):n in [0..104]]; // Marius A. Burtea, Jan 17 2019
    
  • Maple
    seq(convert(convert(n,base,3),`+`),n=0..100); # Robert Israel, Jul 02 2015
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 3], {n, 0, 100}] (* or *)
    Nest[Join[#, # + 1, # + 2] &, {0}, 6] (* Robert G. Wilson v, Jul 27 2006 and modified Jul 27 2014 *)
  • PARI
    {a(n) = if( n<1, 0, a(n\3) + n%3)}; /* Michael Somos, Mar 06 2004 */
    
  • PARI
    A053735(n)=sumdigits(n,3) \\ Requires version >= 2.7. Use sum(i=1,#n=digits(n,3),n[i]) in older versions. - M. F. Hasler, Mar 15 2016
    
  • Scheme
    (define (A053735 n) (let loop ((n n) (s 0)) (if (zero? n) s (let ((d (mod n 3))) (loop (/ (- n d) 3) (+ s d)))))) ;; For R6RS standard. Use modulo instead of mod in older Schemes like MIT/GNU Scheme. - Antti Karttunen, Jun 03 2017
    

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(3n) = a(n), a(3n + 1) = a(n) + 1, a(3n + 2) = a(n) + 2.
a(n) = n - 2*Sum_{k>0} floor(n/3^k) = n - 2*A054861(n). (End)
a(n) = A062756(n) + 2*A081603(n). - Reinhard Zumkeller, Mar 23 2003
G.f.: (Sum_{k >= 0} (x^(3^k) + 2*x^(2*3^k))/(1 + x^(3^k) + x^(2*3^k)))/(1 - x). - Michael Somos, Mar 06 2004, corrected by Franklin T. Adams-Watters, Nov 03 2005
In general, the sum of digits of (n written in base b) has generating function (Sum_{k>=0} (Sum_{0 <= i < b} i*x^(i*b^k))/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005
First differences of A094345. - Vladeta Jovovic, Nov 08 2005
a(A062318(n)) = n and a(m) < n for m < A062318(n). - Reinhard Zumkeller, Feb 26 2008
a(n) = A138530(n,3) for n > 2. - Reinhard Zumkeller, Mar 26 2008
a(n) <= 2*log_3(n+1). - Vladimir Shevelev, Jun 01 2011
a(n) = Sum_{k>=0} A030341(n, k). - Philippe Deléham, Oct 21 2011
G.f. satisfies G(x) = (x+2*x^2)/(1-x^3) + (1+x+x^2)*G(x^3), and has a natural boundary at |x|=1. - Robert Israel, Jul 02 2015
a(n) = A056239(A006047(n)). - Antti Karttunen, Jun 03 2017
a(n) = A000120(A289813(n)) + 2*A000120(A289814(n)). - Antti Karttunen, Jul 20 2017
a(0) = 0; a(n) = a(n - 3^floor(log_3(n))) + 1. - Ilya Gutkovskiy, Aug 23 2019
Sum_{n>=1} a(n)/(n*(n+1)) = 3*log(3)/2 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

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)).

A286586 a(n) = A006047(A048673(n)).

Original entry on oeis.org

2, 3, 2, 6, 4, 9, 3, 12, 8, 6, 6, 18, 2, 18, 3, 24, 4, 12, 4, 12, 4, 9, 6, 36, 18, 27, 6, 36, 12, 54, 6, 48, 6, 6, 8, 24, 6, 18, 24, 24, 12, 6, 9, 18, 12, 36, 2, 72, 18, 27, 12, 54, 4, 81, 12, 72, 12, 18, 8, 108, 12, 9, 12, 96, 9, 36, 4, 12, 18, 36, 8, 48, 16, 27, 24, 36, 9, 36, 12, 48, 72, 18, 6, 12, 24, 54, 27, 36, 24, 18, 16, 72, 8, 81, 2
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
    from functools import reduce
    def a006047(n):
        d=digits(n, 3)
        return n + 1 if n<3 else reduce(mul, [1 + d[i] for i in range(1, len(d))])
    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 a006047(a048673(n))
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286586 n) (A006047 (A048673 n)))
    

Formula

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

A286582 a(n) = A001222(A048673(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Programs

  • PARI
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A048673(n) = (A003961(n)+1)/2;
    A286582(n) = bigomega(A048673(n));
    
  • Python
    from sympy import factorint, nextprime, primefactors, prod
    def a001222(n): return 0 if n==1 else a001222(n//primefactors(n)[-1]) + 1
    def a048673(n):
        f = factorint(n)
        return 1 if n==1 else (1 + prod(nextprime(i)**f[i] for i in f))//2
    def a(n): return a001222(a048673(n))
    print([a(n) for n in range(1, 51)]) # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286582 n) (A001222 (A048673 n)))
    

Formula

a(n) = A001222(A048673(n)).

A286583 a(n) = A007814(A048673(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Cf. A246261 (positions of zeros), A246263 (of nonzeros).

Programs

  • PARI
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A048673(n) = (A003961(n)+1)/2;
    A007814(n) = (valuation(n,2));
    A286583(n) = A007814(A048673(n));
    
  • Python
    from sympy import factorint, nextprime, prod
    def a007814(n): return 1 + bin(n - 1)[2:].count("1") - bin(n)[2:].count("1")
    def a048673(n):
        f = factorint(n)
        return 1 if n==1 else (1 + prod(nextprime(i)**f[i] for i in f))//2
    def a(n): return a007814(a048673(n)) # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286583 n) (A007814 (A048673 n)))
    

Formula

a(n) = A007814(A048673(n)).

A286584 a(n) = A048673(n) mod 4.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Cf. A246261 (positions of odd terms), A246263 (of even terms).

Programs

  • PARI
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A048673(n) = (A003961(n)+1)/2;
    A286584(n) = (A048673(n)%4);
    
  • Python
    from sympy import factorint, nextprime
    from operator import mul
    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 a048673(n)%4 # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286584 n) (modulo (A048673 n) 4))
    

Formula

a(n) = A010873(A048673(n)) = A048673(n) mod 4.

A286632 Base-3 digit sum of A254103: a(n) = A053735(A254103(n)).

Original entry on oeis.org

0, 1, 2, 1, 3, 2, 4, 2, 4, 1, 3, 3, 5, 3, 5, 2, 5, 4, 6, 3, 4, 2, 4, 2, 6, 2, 4, 3, 6, 1, 3, 4, 6, 3, 5, 4, 7, 4, 6, 4, 5, 5, 7, 2, 5, 3, 5, 3, 7, 5, 7, 3, 5, 4, 6, 3, 7, 6, 8, 4, 4, 3, 5, 5, 7, 6, 8, 4, 6, 3, 5, 6, 8, 3, 5, 5, 7, 5, 7, 3, 6, 4, 6, 5, 8, 1, 3, 5, 6, 2, 4, 4, 6, 2, 4, 2, 8, 4, 6, 6, 8, 2, 4, 2, 6, 3, 5, 4, 7, 4, 6, 5, 8, 5, 7, 5, 9, 5, 7, 4, 5
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:
0
|
...................1...................
2 1
3......../ \........2 4......../ \........2
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
4 1 3 3 5 3 5 2
5 4 6 3 4 2 4 2 6 2 4 3 6 1 3 4
etc.

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    def a254103(n):
        if n==0: return 0
        if n%2==0: return 3*a254103(n/2) - 1
        else: return floor((3*(1 + a254103((n - 1)/2)))/2)
    def a(n): return sum(digits(a254103(n), 3)[1:]) # Indranil Ghosh, Jun 06 2017
  • Scheme
    (define (A286632 n) (A053735 (A254103 n)))
    

Formula

a(n) = A053735(A254103(n)).
a(n) = A056239(A286633(n)).
For all n >= 0, a(A000079(n)) = n+1.

A340378 Number of 1-digits in the ternary representation of A048673(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 15 2021

Keywords

Comments

Binary weight of A304759(n).

Crossrefs

Cf. A340376 (positions of zeros).

Programs

Formula

a(n) = A062756(A048673(n)) = A000120(A304759(n)).
a(n) = A286585(n) - 2*A340379(n).

A340379 Number of 2-digits in the ternary representation of A048673(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 15 2021

Keywords

Comments

Binary weight of A291759(n).

Crossrefs

Cf. A340377 (positions of zeros).

Programs

Formula

a(n) = A081603(A048673(n)) = A000120(A291759(n)).
a(n) = (A286585(n) - A340378(n)) / 2.
For all n >= 1, a(n) >= A292252(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];
Showing 1-10 of 10 results.