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.

A300821 Möbius transform of A244042.

Original entry on oeis.org

1, -1, 2, 4, 2, -2, 0, -4, 6, 8, 8, 8, 12, 12, 4, 10, 8, -6, 0, -14, 0, -4, 2, -8, -2, -12, 18, 12, 26, 16, 30, 20, 16, 20, 24, 24, 36, 36, 24, 44, 38, 24, 36, 28, 12, 26, 26, 20, 30, 22, 16, 24, 26, -18, -10, -24, 0, -22, 2, -28, 0, -30, 0, -20, -6, -8, 12, -20, 4, -36, 8, -24, 0, -36, -4, -36, -6, -24, 0, -50, 54, 44, 80, 24
Offset: 1

Views

Author

Antti Karttunen, Mar 14 2018

Keywords

Crossrefs

Programs

  • Mathematica
    Table[DivisorSum[n, MoebiusMu[n/#] FromDigits[IntegerDigits[#, 3] /. 2 -> 0, 3] &], {n, 84}] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    A244042(n) = fromdigits(apply(x->(x%2), digits(n, 3)), 3);
    A300821(n) = sumdiv(n,d,moebius(n/d)*A244042(d));

Formula

a(n) = Sum_{d|n} moebius(n/d)*A244042(d).
a(n) = A000010(n) - A300822(n).
a(n) = A244042(n) - A300823(n).

A300823 Difference between A244042 and its Möbius transform.

Original entry on oeis.org

0, 1, 1, 0, 1, 2, 1, 4, 3, 2, 1, 4, 1, 0, 5, 0, 1, 6, 1, 14, 3, 8, 1, 8, 3, 12, 9, 16, 1, 14, 1, 10, 11, 8, 3, 12, 1, 0, 15, -4, 1, 12, 1, 8, 15, 2, 1, 10, 1, 8, 11, 4, 1, 18, 11, 24, 3, 26, 1, 28, 1, 30, 9, 30, 15, 20, 1, 32, 5, 46, 1, 24, 1, 36, 7, 40, 9, 24, 1, 50, 27, 38, 1, 60, 11, 36, 29, 32, 1, 42, 13, 32, 33, 26, 3, 50, 1
Offset: 1

Views

Author

Antti Karttunen, Mar 14 2018

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[IntegerDigits[n, 3] /. 2 -> 0, 3]; Table[f@ n - DivisorSum[n, MoebiusMu[n/#] f@ # &], {n, 97}] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    A244042(n) = fromdigits(apply(x->(x%2), digits(n, 3)), 3);
    A300823(n) = -sumdiv(n,d,(dA244042(d));

Formula

a(n) = A244042(n) - A300821(n).
a(n) = -Sum_{d|n, dA008683(n/d)*A244042(d) = Sum_{d|n, dA300821(d).
a(n) = A051953(n) - A300824(n).

A359601 Dirichlet inverse of A244042, where A244042(n) replaces 2's with 0's in the ternary representation of n.

Original entry on oeis.org

1, 0, -3, -4, -3, 0, -1, 0, 0, -10, -9, 12, -13, -12, 9, 6, -9, 0, -1, 24, 3, -4, -3, 0, 8, 0, 0, -20, -27, 30, -31, -30, 27, -28, -21, 0, -37, -36, 39, 40, -39, 36, -37, 36, 0, -28, -27, -18, -30, 30, 27, 76, -27, 0, 53, 96, 3, -4, -3, -72, -1, 0, 0, 6, 69, 12, -13, 60, 9, 82, -9, 0, -1, 0, -24, 4, 15
Offset: 1

Views

Author

Antti Karttunen, Jan 11 2023

Keywords

Crossrefs

Cf. A056911 (positions of odd terms), A323239 (parity of terms), A337945.

Programs

  • PARI
    A244042(n) = fromdigits(apply(x->(x%2), digits(n, 3)), 3);
    memoA359601 = Map();
    A359601(n) = if(1==n,1,my(v); if(mapisdefined(memoA359601,n,&v), v, v = -sumdiv(n,d,if(dA244042(n/d)*A359601(d),0)); mapput(memoA359601,n,v); (v)));

Formula

a(1) = 1, and for n > 1, a(n) = -Sum_{d|n, dA244042(n/d) * a(d).
a(n) = A359602(n) - A244042(n).

A359602 Sum of A244042 and its Dirichlet inverse, where A244042(n) replaces 2's with 0's in the ternary representation of n.

Original entry on oeis.org

2, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0, 18, 16, 0, 0, 0, 24, 6, 0, 0, 0, 9, 0, 27, 8, 0, 60, 0, 0, 54, 0, 6, 36, 0, 0, 78, 80, 0, 72, 0, 72, 27, 0, 0, 12, 1, 60, 54, 104, 0, 0, 54, 96, 6, 0, 0, -72, 0, 0, 9, 16, 78, 24, 0, 72, 18, 92, 0, 0, 0, 0, -21, 8, 18, 0, 0, -84, 81, 0, 0, 144, 54, 0, 162, 32
Offset: 1

Views

Author

Antti Karttunen, Jan 11 2023

Keywords

Crossrefs

Cf. A053850 (positions of odd terms), A353569 (parity of terms).

Programs

Formula

a(n) = A244042(n) + A359601(n).
a(1) = 2, and for n > 1, a(n) = -Sum_{d|n, 1A244042(d) * A359601(n/d).

A004488 Tersum n + n.

Original entry on oeis.org

0, 2, 1, 6, 8, 7, 3, 5, 4, 18, 20, 19, 24, 26, 25, 21, 23, 22, 9, 11, 10, 15, 17, 16, 12, 14, 13, 54, 56, 55, 60, 62, 61, 57, 59, 58, 72, 74, 73, 78, 80, 79, 75, 77, 76, 63, 65, 64, 69, 71, 70, 66, 68, 67, 27, 29, 28, 33, 35, 34, 30, 32, 31, 45, 47, 46, 51
Offset: 0

Views

Author

Keywords

Comments

Could also be described as "Write n in base 3, then replace each digit with its base-3 negative" as with A048647 for base 4. - Henry Bottomley, Apr 19 2000
a(a(n)) = n, a self-inverse permutation of the nonnegative integers. - Reinhard Zumkeller, Dec 19 2003
First 3^n terms of the sequence form a permutation s(n) of 0..3^n-1, n>=1; the number of inversions of s(n) is A016142(n-1). - Gheorghe Coserea, Apr 23 2018

Crossrefs

Programs

  • Haskell
    a004488 0 = 0
    a004488 n = if d == 0 then 3 * a004488 n' else 3 * a004488 n' + 3 - d
                where (n', d) = divMod n 3
    -- Reinhard Zumkeller, Mar 12 2014
    
  • Maple
    a:= proc(n) local t, r, i;
          t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+3^i *irem(2*irem(t, 3, 't'), 3)
          od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Sep 07 2011
  • Mathematica
    a[n_] := FromDigits[Mod[3-IntegerDigits[n, 3], 3], 3]; Table[a[n], {n, 0, 66}] (* Jean-François Alcover, Mar 03 2014 *)
  • PARI
    a(n) = my(b=3); fromdigits(apply(d->(b-d)%b, digits(n, b)), b);
    vector(67, i, a(i-1))  \\ Gheorghe Coserea, Apr 23 2018
    
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3) # Indranil Ghosh, Jun 06 2017

Formula

Tersum m + n: write m and n in base 3 and add mod 3 with no carries, e.g., 5 + 8 = "21" + "22" = "10" = 1.
a(n) = Sum(3-d(i)-3*0^d(i): n=Sum(d(i)*3^d(i): 0<=d(i)<3)). - Reinhard Zumkeller, Dec 19 2003
a(3*n) = 3*a(n), a(3*n+1) = 3*a(n)+2, a(3*n+2) = 3*a(n)+1. - Robert Israel, May 09 2014

A117966 Balanced ternary enumeration (based on balanced ternary representation) of integers; write n in ternary and then replace 2's with (-1)'s.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

As the graph demonstrates, there are large discontinuities in the sequence between terms 3^i-1 and 3^i, and between terms 2*3^i-1 and 2*3^i. - N. J. A. Sloane, Jul 03 2016

Examples

			7 in base 3 is 21; changing the 2 to a (-1) gives (-1)*3+1 = -2, so a(7) = -2. I.e., the number of -2 according to the balanced ternary enumeration is 7, which can be obtained by replacing every -1 by 2 in the balanced ternary representation (or expansion) of -2, which is -1,1.
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 2, pp. 173-175; 2nd. ed. pp. 190-193.

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,i;
       L:= subs(2=-1,convert(n,base,3));
       add(L[i]*3^(i-1),i=1..nops(L))
    end proc:
    map(f, [$0..100]);
    # alternate:
    N:= 100: # to get a(0) to a(N)
    g:= 0:
    for n from 1 to ceil(log[3](N+1)) do
    g:= convert(series(3*subs(x=x^3,g)*(1+x+x^2)+x/(1+x+x^2),x,3^n+1),polynom);
    od:
    seq(coeff(g,x,j),j=0..N); # Robert Israel, Nov 17 2015
    # third Maple program:
    a:= proc(n) option remember; `if`(n=0, 0,
          3*a(iquo(n, 3, 'r'))+`if`(r=2, -1, r))
        end:
    seq(a(n), n=0..3^4-1);  # Alois P. Heinz, Aug 14 2019
  • Mathematica
    Map[FromDigits[#, 3] &, IntegerDigits[#, 3] /. 2 -> -1 & /@ Range@ 80] (* Michael De Vlieger, Nov 17 2015 *)
  • PARI
    a(n) = subst(Pol(apply(x->if(x == 2, -1, x), digits(n,3)), 'x), 'x, 3)
    vector(73, i, a(i-1))  \\ Gheorghe Coserea, Nov 17 2015
    
  • Python
    def a(n):
        if n==0: return 0
        if n%3==0: return 3*a(n//3)
        elif n%3==1: return 3*a((n - 1)//3) + 1
        else: return 3*a((n - 2)//3) - 1
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 06 2017

Formula

a(0) = 0, a(3n) = 3a(n), a(3n+1) = 3a(n)+1, a(3n+2) = 3a(n)-1.
G.f. satisfies A(x) = 3*A(x^3)*(1+x+x^2) + x/(1+x+x^2). - corrected by Robert Israel, Nov 17 2015
A004488(n) = a(n)^{-1}(-a(n)). I.e., if a(n) <= 0, A004488(n) = A117967(-a(n)) and if a(n) > 0, A004488(n) = A117968(a(n)).
a(n) = n - 3 * A005836(A289814(n) + 1). - Andrey Zabolotskiy, Nov 11 2019

Extensions

Name corrected by Andrey Zabolotskiy, Nov 10 2019

A300222 In ternary (base-3) representation of n, replace 1's with 0's.

Original entry on oeis.org

0, 0, 2, 0, 0, 2, 6, 6, 8, 0, 0, 2, 0, 0, 2, 6, 6, 8, 18, 18, 20, 18, 18, 20, 24, 24, 26, 0, 0, 2, 0, 0, 2, 6, 6, 8, 0, 0, 2, 0, 0, 2, 6, 6, 8, 18, 18, 20, 18, 18, 20, 24, 24, 26, 54, 54, 56, 54, 54, 56, 60, 60, 62, 54, 54, 56, 54, 54, 56, 60, 60, 62, 72, 72, 74, 72, 72, 74, 78, 78, 80, 0, 0, 2, 0, 0, 2, 6, 6, 8, 0, 0, 2
Offset: 0

Views

Author

Antti Karttunen, Mar 14 2018

Keywords

Examples

			For n=46, which in base-3 (A007089) is 1201, replacing 1's with 0's gives 200, and as that is base-3 representation of 18 (= 2*(3^2) + 0*(3^1) + 0*(3^0)), a(46) = 18.
		

Crossrefs

Cf. A300822 (Moebius transform).

Programs

  • Mathematica
    Array[FromDigits[IntegerDigits[#, 3] /. 1 -> 0, 3] &, 93, 0] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    A244042(n) = fromdigits(apply(x->(x%2), digits(n, 3)), 3);
    A300222(n) = (n - A244042(n));
    \\ Or directly as:
    A300222(n) = fromdigits(apply(x->(if (1==x, 0, x)), digits(n, 3)), 3);

Formula

a(n) = n - A244042(n) = 2*A244042(A004488(n)).
a(n) = 2*A005836(1+A289814(n)). [With the current starting offset 1 of A005836.]
a(n) = A300822(n) + A300824(n).

A300825 Filter sequence combining A300823(n) and A300824(n).

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 2, 5, 6, 7, 2, 8, 2, 9, 10, 9, 2, 11, 2, 12, 13, 14, 2, 15, 16, 17, 18, 19, 2, 20, 2, 21, 22, 23, 24, 25, 2, 26, 27, 28, 2, 29, 2, 30, 31, 32, 2, 33, 34, 35, 36, 37, 2, 38, 39, 40, 41, 42, 2, 43, 2, 44, 45, 44, 46, 47, 2, 48, 49, 50, 2, 51, 2, 52, 53, 54, 55, 56, 2, 57, 58, 59, 2, 60, 61, 62, 63, 64, 2, 65, 66, 64, 67, 68, 69
Offset: 1

Views

Author

Antti Karttunen, Mar 14 2018

Keywords

Comments

Restricted growth sequence transform of ordered pair [A300823(n), A300824(n)].
For all i, j: a(i) = a(j) => A051953(i) = A051953(j).

Crossrefs

Programs

  • PARI
    up_to = 65537;
    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; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A244042(n) = fromdigits(apply(x->(x%2), digits(n, 3)), 3);
    A300823(n) = -sumdiv(n,d,(dA244042(d));
    A300222(n) = (n - A244042(n));
    A300824(n) = -sumdiv(n,d,(dA300222(d));
    Aux300825(n) = [A300823(n), A300824(n)];
    write_to_bfile(1,rgs_transform(vector(up_to,n,Aux300825(n))),"b300825.txt");
Showing 1-8 of 8 results.