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 11 results. Next

A032924 Numbers whose ternary expansion contains no 0.

Original entry on oeis.org

1, 2, 4, 5, 7, 8, 13, 14, 16, 17, 22, 23, 25, 26, 40, 41, 43, 44, 49, 50, 52, 53, 67, 68, 70, 71, 76, 77, 79, 80, 121, 122, 124, 125, 130, 131, 133, 134, 148, 149, 151, 152, 157, 158, 160, 161, 202, 203, 205, 206, 211, 212, 214, 215, 229, 230, 232, 233, 238, 239
Offset: 1

Views

Author

Keywords

Comments

Complement of A081605. - Reinhard Zumkeller, Mar 23 2003
Subsequence of A154314. - Reinhard Zumkeller, Jan 07 2009
The first 28 terms are the range of A059852 (Morse codes for letters, when written in base 3) union {44, 50} (which correspond to Morse codes of Ü and Ä). Subsequent terms represent the Morse code of other symbols in the same coding. - M. F. Hasler, Jun 22 2020

Crossrefs

Zeroless numbers in some other bases <= 10: A000042 (base 2), A023705 (base 4), A248910 (base 6), A255805 (base 8), A255808 (base 9), A052382 (base 10).

Programs

  • Haskell
    a032924 n = a032924_list !! (n-1)
    a032924_list = iterate f 1 where
       f x = 1 + if r < 2 then x else 3 * f x'  where (x', r) = divMod x 3
    -- Reinhard Zumkeller, Mar 07 2015, May 04 2012
    
  • Maple
    f:= proc(n) local L,i,m;
       L:= convert(n,base,2);
       m:= nops(L);
       add((1+L[i])*3^(i-1),i=1..m-1);
    end proc:
    map(f, [$2..101]); # Robert Israel, Aug 04 2015
  • Mathematica
    Select[Range@ 240, Last@ DigitCount[#, 3] == 0 &] (* Michael De Vlieger, Aug 05 2015 *)
    Flatten[Table[FromDigits[#,3]&/@Tuples[{1,2},n],{n,5}]] (* Harvey P. Dale, May 28 2016 *)
  • PARI
    apply( {A032924(n)=if(n<3,n,3*self()((n-1)\2)+2-n%2)}, [1..99]) \\ M. F. Hasler, Jun 22 2020
    
  • PARI
    a(n) = fromdigits(apply(d->d+1,binary(n+1)[^1]), 3); \\ Kevin Ryde, Jun 23 2020
    
  • Python
    def a(n): return sum(3**i*(int(b)+1) for i, b in enumerate(bin(n+1)[:2:-1]))
    print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Aug 15 2022
    
  • Python
    def is_A032924(n):
        while n > 2:
           n,r = divmod(n,3)
           if r==0: return False
        return n > 0
    print([n for n in range(250) if is_A032924(n)]) # M. F. Hasler, Feb 15 2023
    
  • Python
    def A032924(n): return int(bin(m:=n+1)[3:],3) + (3**(m.bit_length()-1)-1>>1) # Chai Wah Wu, Oct 13 2023

Formula

a(n) = A107680(n) + A107681(n). - Reinhard Zumkeller, May 20 2005
A081604(A107681(n)) <= A081604(A107680(n)) = A081604(a(n)) = A000523(n+1). - Reinhard Zumkeller, May 20 2005
A077267(a(n)) = 0. - Reinhard Zumkeller, Mar 02 2008
a(1)=1, a(n+1) = f(a(n)+1,a(n)+1) where f(x,y) = if x<3 and x<>0 then y, else if x mod 3 = 0 then f(y+1,y+1), else f(floor(x/3),y). - Reinhard Zumkeller, Mar 02 2008
a(2*n) = a(2*n-1)+1, n>0. - Zak Seidov, Jul 27 2009
A212193(a(n)) = 0. - Reinhard Zumkeller, May 04 2012
a(2*n+1) = 3*a(n)+1. - Robert Israel, Aug 05 2015
G.f.: x/(1-x)^2 + Sum_{m >= 1} 3^(m-1)*x^(2^(m+1)-1)/((1-x^(2^m))*(1-x)). - Robert Israel, Aug 04 2015
A065361(a(n)) = n. - Rémy Sigrist, Feb 06 2023
Sum_{n>=1} 1/a(n) = 3.4977362637842652509313189236131190039368413460747606236619907531632476445332666030262441154353753276457... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Apr 14 2025

A157671 Numbers whose ternary representation begins with 2.

Original entry on oeis.org

2, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184
Offset: 1

Views

Author

Zak Seidov, Mar 04 2009

Keywords

Comments

From R. J. Mathar, Mar 03 2009: (Start)
If we look at the sequence first differences, i.e.,
2, 4, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 82, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, we obtain the records in A034472. (End)
The lower and upper asymptotic densities of this sequence are 1/4 and 1/2, respectively. - Amiram Eldar, Feb 28 2021

Crossrefs

Subsequence of A134026. - Reinhard Zumkeller, Jan 20 2010

Programs

  • Haskell
    a157671 n = a157671_list !! (n-1)
    a157671_list = filter ((== 2) . until (< 3) (flip div 3)) [1..]
    -- Reinhard Zumkeller, Feb 06 2015
  • Maple
    for n from 1 to 300 do dgs := convert(n,base,3) ; if op(-1,dgs) = 2 then printf("%d,",n) ; fi; od: # R. J. Mathar, Mar 03 2009
  • Mathematica
    Flatten[(Range[2*3^#,3^(#+1)-1])&/@Range[0,4]]
    Select[Range[200],First[IntegerDigits[#,3]]==2&] (* Harvey P. Dale, Oct 16 2012 *)
    Table[FromDigits[#,3]&/@(Join[{2},#]&/@Tuples[{0,1,2},n]),{n,0,4}]// Flatten (* Harvey P. Dale, Jan 28 2022 *)
  • PARI
    s=[];for(n=0,4,for(x=3^n,2*3^n-1,s=concat(s,x)));s
    

Formula

A number k is a term if and only if 2*3^m <= k <= 3^(m+1)-1, for m=0,1,2,...
A171960(a(n)) < a(n). - Reinhard Zumkeller, Jan 20 2010

A325825 Square array giving the monic polynomial q satisfying q = gcd(P(x),P(y)) where P(x) and P(y) are polynomials in ring GF(3)[X] with coefficients in {0,1,2} given by the ternary expansions of x and y. The polynomial q is converted back to a ternary number, and then expressed in decimal.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 5, 3, 5, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 3, 1, 1, 3, 1, 4, 3, 1, 1
Offset: 1

Views

Author

Antti Karttunen, May 22 2019

Keywords

Comments

Array is symmetric, and is read by antidiagonals, with (x,y) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), ...
If there is a polynomial q that satisfies q = gcd(P(x),P(y)), then also polynomial -q (which is obtained by changing all nonzero coefficients of q as 1 <--> 2, see A004488) satisfies the same relation, because there are two units (+1 and -1) in polynomial ring GF(3)[X]. Here we always choose the polynomial that is monic (i.e., with a leading coefficient +1), thus its base-3 encoding has "1" as its most significant digit, and the terms given here are all included in A132141.

Examples

			The array begins as:
   y
x      1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,  12,  ...
   --+-----------------------------------------------------
   1 | 1,  1,  1,  1,  1,  1,  1,  1,  1,   1,  1,  1,  ...
   2 | 1,  1,  1,  1,  1,  1,  1,  1,  1,   1,  1,  1,  ...
   3 | 1,  1,  3,  1,  1,  3,  1,  1,  3,   1,  1,  3,  ...
   4 | 1,  1,  1,  4,  1,  1,  1,  4,  1,   1,  4,  4,  ...
   5 | 1,  1,  1,  1,  5,  1,  5,  1,  1,   1,  5,  1,  ...
   6 | 1,  1,  3,  1,  1,  3,  1,  1,  3,   1,  1,  3,  ...
   7 | 1,  1,  1,  1,  5,  1,  5,  1,  1,   1,  5,  1,  ...
   8 | 1,  1,  1,  4,  1,  1,  1,  4,  1,   1,  4,  4,  ...
   9 | 1,  1,  3,  1,  1,  3,  1,  1,  9,   1,  1,  3,  ...
  10 | 1,  1,  1,  1,  1,  1,  1,  1,  1,  10,  1,  1,  ...
  11 | 1,  1,  1,  4,  5,  1,  5,  4,  1,   1, 11,  4,  ...
  12 | 1,  1,  3,  4,  1,  3,  1,  4,  3,   1,  4, 12,  ...
		

Crossrefs

Central diagonal: A330740 (after its initial zero).

Programs

  • PARI
    up_to = 105;
    A004488(n) = subst(Pol(apply(x->(3-x)%3, digits(n, 3)), 'x), 'x, 3);
    A325825sq(a,b) = { my(a=fromdigits(Vec(lift(gcd(Pol(digits(a,3))*Mod(1, 3),Pol(digits(b,3))*Mod(1, 3)))),3), b=A004488(a)); min(a,b); };
    A325825list(up_to) = { my(v = vector(up_to), i=0); for(a=1,oo, for(col=1,a, i++; if(i > up_to, return(v)); v[i] = A325825sq(col,(a-(col-1))))); (v); };
    v325825 = A325825list(up_to);
    A325825(n) = v325825[n];

A330740 a(n) = min(n, A004488(n)), where A004488(n) is base-3 sum n+n without carries.

Original entry on oeis.org

0, 1, 1, 3, 4, 5, 3, 5, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 11, 10, 15, 17, 16, 12, 14, 13, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 27, 29, 28, 33, 35, 34, 30, 32, 31, 45, 47, 46, 51, 53, 52, 48, 50, 49, 36, 38, 37, 42, 44, 43, 39, 41, 40, 81
Offset: 0

Views

Author

Antti Karttunen, Jan 11 2020

Keywords

Comments

After the initial zero, sequence contains only terms of A132141, each appearing exactly twice.

Crossrefs

Central diagonal of A325825 (after the initial zero).

Programs

  • PARI
    A330740(n) = min(n,subst(Pol(apply(x->(3-x)%3, digits(n, 3)), 'x), 'x, 3));

Formula

a(n) = min(n, A004488(n)).

A132140 Numbers containing no zeros in ternary representation and with an initial 1.

Original entry on oeis.org

1, 4, 5, 13, 14, 16, 17, 40, 41, 43, 44, 49, 50, 52, 53, 121, 122, 124, 125, 130, 131, 133, 134, 148, 149, 151, 152, 157, 158, 160, 161, 364, 365, 367, 368, 373, 374, 376, 377, 391, 392, 394, 395, 400, 401, 403, 404, 445, 446, 448, 449, 454, 455, 457, 458, 472
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 20 2007

Keywords

Comments

Intersection of A032924 and A132141;
A132138(A132139(a(n))) = 1.

Examples

			14 is in the sequence because its ternary representation is 112;
15 is not in the sequence because its ternary representation is 120.
		

Crossrefs

Programs

  • Haskell
    a132140 n = a132140_list !! (n-1)
    a132140_list = filter f [1..] where
       f x = x < 3 && x == 1 || t > 0 && f x' where (x', t) = divMod x 3
    -- Reinhard Zumkeller, Feb 06 2015
  • Maple
    a:=proc(n) local nn, L: nn:=convert(n,base,3): L:=nops(nn): if nn[L]=1 and 0 < product(nn[j],j=1..L) then n else end if end proc: seq(a(n),n=1..500); # Emeric Deutsch, Sep 09 2007
  • Mathematica
    Flatten[Table[FromDigits[Join[{1},#],3]&/@Tuples[{1,2},n],{n,0,5}]] (* Harvey P. Dale, Jan 28 2015 *)

A338245 Nonnegative values in A117966, in order of appearance.

Original entry on oeis.org

0, 1, 3, 4, 2, 9, 10, 8, 12, 13, 11, 6, 7, 5, 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, 81, 82, 80, 84, 85, 83, 78, 79, 77, 90, 91, 89, 93, 94, 92, 87, 88, 86, 72, 73, 71, 75, 76, 74, 69, 70, 68
Offset: 0

Views

Author

Rémy Sigrist, Oct 18 2020

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A338247 (the offset has been set to 0 so as to get a permutation).
There are only two fixed points: a(0) = 0 and a(1) = 1.

Examples

			A117966 = 0, 1, -1, 3, 4, 2, -3, -2, -4, 9, 10, 8, 12, 13, 11, 6, 7, 5, ...
We keep:  0, 1,     3, 4, 2,             9, 10, 8, 12, 13, 11, 6, 7, 5, ...
		

Crossrefs

See A338248 for a similar sequence.

Programs

  • PARI
    A117966(n) = subst(Pol(apply(x->if(x == 2, -1, x), digits(n, 3)), 'x), 'x, 3)
    print (select(v -> v>=0, apply(A117966, [0..107])))

Formula

a(0) = 0.
a(n) = A117966(A132141(n)) for any n > 0.

A351702 In the balanced ternary representation of n, reverse the order of digits other than the most significant.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 8, 11, 6, 9, 12, 7, 10, 13, 14, 23, 32, 17, 26, 35, 20, 29, 38, 15, 24, 33, 18, 27, 36, 21, 30, 39, 16, 25, 34, 19, 28, 37, 22, 31, 40, 41, 68, 95, 50, 77, 104, 59, 86, 113, 44, 71, 98, 53, 80, 107, 62, 89, 116, 47, 74, 101, 56, 83, 110, 65, 92
Offset: 0

Views

Author

Kevin Ryde, Feb 19 2022

Keywords

Comments

Self-inverse permutation with swaps confined to terms of a given digit length (A134021) so within blocks n = (3^k+1)/2 .. (3^(k+1)-1)/2.
Can extend to negative n by a(-n) = -a(n).
A072998 is balanced ternary coded in decimal digits so that reversal except first digit of A072998(n) is at A072998(a(n)). Similarly its ternary equivalent A157671, and also A132141 ternary starting with 1.
These sequences all have a fixed initial digit followed by all ternary strings which is the reversed part. A007932 is such strings as decimal digits 1,2,3 but it omits the empty string so the whole reversal of A007932(n) is at A007932(a(n+1)-1).
Fixed points a(n) = n are where n in balanced ternary is a palindrome apart from its initial 1. These are the full balanced ternary palindromes with their least significant 1 removed, so all n = (A134027(m)-1)/3 for m>=2.

Examples

			n    = 224 = balanced ternary 1,  0, -1, 1,  0, -1
                      reverse     ^^^^^^^^^^^^^^^^
a(n) = 168 = balanced ternary 1, -1,  0, 1, -1,  0
		

Crossrefs

Cf. A059095 (balanced ternary), A134028 (full reverse), A134027 (palindromes).
In other bases: A059893 (binary), A343150 (Zeckendorf), A343152 (lazy Fibonacci).

Programs

  • PARI
    a(n) = if(n==0,0, my(k=if(n,logint(n<<1,3)), s=(3^k+1)>>1); s + fromdigits(Vec(Vecrev(digits(n-s,3)),k),3));

A328749 a(n) = Sum_{k = 0..w and t_k > 0} (-1)^t_k * 2^k, where Sum_{k = 0..w} t_k * 3^k is the ternary representation of n.

Original entry on oeis.org

0, -1, 1, -2, -3, -1, 2, 1, 3, -4, -5, -3, -6, -7, -5, -2, -3, -1, 4, 3, 5, 2, 1, 3, 6, 5, 7, -8, -9, -7, -10, -11, -9, -6, -7, -5, -12, -13, -11, -14, -15, -13, -10, -11, -9, -4, -5, -3, -6, -7, -5, -2, -3, -1, 8, 7, 9, 6, 5, 7, 10, 9, 11, 4, 3, 5, 2, 1, 3, 6
Offset: 0

Views

Author

Rémy Sigrist, Oct 27 2019

Keywords

Comments

Every integer appears in the sequence.

Examples

			a(42) = a(1*3^3 + 1*3^2 + 2*3^1) = -2^3 - 2^2 + 2^1 = -10.
		

Crossrefs

Programs

  • PARI
    a(n) = my (d=Vecrev(digits(n,3))); sum(i=1, #d, if (d[i], (2^i) * (-1)^d[i], 0))/2
    
  • Python
    from sympy.ntheory.factor_ import digits
    def A328749(n): return sum((-(1<0) # Chai Wah Wu, Apr 12 2023

Formula

a(n) = 0 iff n = 0.
a(n) > 0 iff n belongs to A157671.
a(n) < 0 iff n belongs to A132141.
a(A004488(n)) = -a(n).

A033054 Numbers whose base-3 representation Sum_{i=0..m} d(i)*3^i has d(i)=1 for m-i odd.

Original entry on oeis.org

1, 2, 4, 7, 12, 13, 14, 21, 22, 23, 37, 40, 43, 64, 67, 70, 111, 112, 113, 120, 121, 122, 129, 130, 131, 192, 193, 194, 201, 202, 203, 210, 211, 212, 334, 337, 340, 361, 364, 367, 388, 391, 394, 577, 580, 583, 604, 607, 610, 631
Offset: 1

Views

Author

Keywords

Crossrefs

Disjoint with A032953 if more than 1 digit.

Programs

  • Maple
    N:= 1000: # to get a(1) to a(N)
    K:= ceil((N-4)/3):
    Dmax:= ilog[3](ceil(K/2+1)):
    A:= Vector(3*K+4):
    A[1..4]:= <1,2,4,7>:
    for d from 0 to Dmax do
      for k from 2*3^d-1 to min(4*3^d-2,K) do
         A[3*k+2]:= 9*A[k]+3;
         A[3*k+3]:= 9*A[k]+4;
         A[3*k+4]:= 9*A[k]+5
      od:
      for k from 4*3^d-1 to min(2*3^(d+1)-2,K) do
         A[3*k+2]:= 9*A[k]+1;
         A[3*k+3]:= 9*A[k]+4;
         A[3*k+4]:= 9*A[k]+7
      od:
    od:
    seq(A[i],i=1..N); # Robert Israel, Jun 06 2016

Formula

From Robert Israel, Jun 06 2016: (Start)
a(3n+3) = 9a(n)+4.
If A110654(n) is in A132141 then a(3n+2) = 9a(n)+3 and a(3n+4) = 9a(n)+5
otherwise a(3n+2) = 9a(n)+1 and a(3n+4) = 9a(n)+7.
G.f. satisfies g(x) = 9(x^2+x^3+x^4)g(x^3) + (x+2x^2+4x^3+6x^4-x^5)/(1-x^3) + ((2+2x)/(x+x^2+x^3)) Sum_{k>=1}(x^(2*3^k)-x^(4*3^k)).
(End)

Extensions

Name corrected by Robert Israel, Jun 06 2016

A333773 Replace 2's with (-1)'s in ternary representation of n and sum nonzero terms with alternating signs.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 05 2020

Keywords

Comments

This sequence is a variant of A117966, and shares features with A065620.
Every integer appears exactly once in this sequence.

Examples

			For n = 97:
- 97 = 3^4 + 3^2 + 2*3^1 + 3^0,
- hence a(97) = 3^4 - 3^2 + (-1)*3^1 - 3^0 = 68.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=0, t=Vecrev(digits(n,3))); for (k=1, #t, if (t[k]==1, v=+3^(k-1)-v, t[k]==2, v=-3^(k-1)-v)); v }

Formula

a(3*n) = 3*a(n).
a(3*n+1) = 3*a(n) + (-1)^A160384(n).
a(3*n+2) = 3*a(n) - (-1)^A160384(n).
Sum_{k=0..n} a(k) >= 0 with equality iff n belongs to A024023.
a(n) > 0 iff n belongs to A132141.
a(n) < 0 iff n belongs to A157671.
a(A004488(n)) = -a(n).
Showing 1-10 of 11 results. Next