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.

A061393 Number of appearances of n in sequence defined by b(k) = b(floor(k/3)) + b(ceiling(k/3)) with b(0)=0 and b(1)=1, i.e., in A061392.

Original entry on oeis.org

1, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2, 10, 2, 4, 2, 82, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2, 10, 2, 4, 2, 244, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2, 10, 2, 4, 2, 82, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2, 10, 2, 4, 2, 730, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2, 10, 2, 4, 2, 82, 2, 4, 2, 10, 2, 4, 2, 28, 2, 4, 2
Offset: 0

Views

Author

Henry Bottomley, Apr 30 2001

Keywords

Comments

In the binary expansion of n, delete everything left of the rightmost 1 bit, then interpret as ternary and add 1. - Ralf Stephan, Aug 22 2013

Crossrefs

Cf. A061392.

Programs

Formula

a(n) = A034472(A007814(n)) for n > 0.
a(2n) = 3a(n)-2; a(2n+1) = 2.
G.f.: 1/(1-x) + Sum_{k>=0} 3^k*x^2^k/(1 - x^2^(k+1)). - Ralf Stephan, Jun 13 2003

A005823 Numbers whose ternary expansion contains no 1's.

Original entry on oeis.org

0, 2, 6, 8, 18, 20, 24, 26, 54, 56, 60, 62, 72, 74, 78, 80, 162, 164, 168, 170, 180, 182, 186, 188, 216, 218, 222, 224, 234, 236, 240, 242, 486, 488, 492, 494, 504, 506, 510, 512, 540, 542, 546, 548, 558, 560, 564, 566, 648, 650, 654, 656, 666, 668, 672, 674
Offset: 1

Views

Author

Keywords

Comments

The set of real numbers between 0 and 1 that contain no 1's in their ternary expansion is the well-known Cantor set with Hausdorff dimension log 2 / log 3.
Complement of A081606. - Reinhard Zumkeller, Mar 23 2003
Numbers k such that the k-th Apery number is congruent to 1 (mod 3) (cf. A005258). - Benoit Cloitre, Nov 30 2003
Numbers k such that the k-th central Delannoy number is congruent to 1 (mod 3) (cf. A001850). - Benoit Cloitre, Nov 30 2003
Numbers k such that there exists a permutation p_1, ..., p_k of 1, ..., k such that i + p_i is a power of 3 for every i. - Ray Chandler, Aug 03 2004
Subsequence of A125292. - Reinhard Zumkeller, Nov 26 2006
The first 2^n terms of the sequence could be obtained using the Cantor process for the segment [0,3^n-1]. E.g., for n=2 we have [0,{1},2,{3,4,5},6,{7},8]. The numbers outside of braces are the first 4 terms of the sequence. Therefore the terms of the sequence could be called "Cantor's numbers". - Vladimir Shevelev, Jun 13 2008
Mahler proved that positive a(n) is never a square. - Michel Marcus, Nov 12 2012
Define t: Z -> P(R) so that t(k) is the translated Cantor ternary set spanning [k, k+1], and let T be the union of t(a(n)) for all n. T = T * 3 = T / 3 is the closure of the Cantor ternary set under multiplication by 3. - Peter Munn, Oct 30 2019

References

  • K. J. Falconer, The Geometry of Fractal Sets, Cambridge, 1985; p. 14.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Twice A005836.
Cf. A088917 (characteristic function), A306556.

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n=1, 0, `if`(irem (n, 2, 'q')=0, 3*a(q)+2, 3*a(q+1)))
        end:
    seq(a(n), n=1..100); # Alois P. Heinz, Apr 19 2012
  • Mathematica
    Select[ Range[ 0, 729 ], (Count[ IntegerDigits[ #, 3 ], 1 ]==0)& ]
    Select[Range[0,700],DigitCount[#,3,1]==0&] (* Harvey P. Dale, Mar 12 2016 *)
  • PARI
    is(n)=while(n,if(n%3==1,return(0),n\=3));1 \\ Charles R Greathouse IV, Apr 20 2012
    
  • PARI
    a(n)=n=binary(n-1);sum(i=1,#n,2*n[i]*3^(#n-i)) \\ Charles R Greathouse IV, Apr 20 2012
    
  • PARI
    a(n)=2*fromdigits(binary(n-1),3) \\ Charles R Greathouse IV, Aug 24 2016
    
  • Python
    def A005823(n):
        return 2*int(format(n-1,'b'),3) # Chai Wah Wu, Jan 04 2015

Formula

a(n) = 2 * A005836(n).
a(2n) = 3*a(n)+2, a(2n+1) = 3*a(n+1), a(1) = 0.
a(n) = Sum_{k = 1..n} 1 + 3^A007814(k). - Philippe Deléham, Jul 09 2005
A125291(a(n)) = 1 for n>0. - Reinhard Zumkeller, Nov 26 2006
From Reinhard Zumkeller, Mar 02 2008: (Start)
A062756(a(n)) = 0.
If the offset were changed to zero, then: a(0) = 0, a(n+1) = f(a(n)+1, a(n)+1) where f(x, y) = if x < 3 and x <> 1 then y else if x mod 3 = 1 then f(y+1, y+1) else f(floor(x/3), y). (End)
G.f. g(x) satisfies g(x) = 3*g(x^2)*(1+1/x) + 2*x^2/(1-x^2). - Robert Israel, Jan 04 2015
Sum_{n>=2} 1/a(n) = 1.341426555483087715426958452292349687410838545707857407585878304836140592352... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 12 2022

Extensions

More terms from Sascha Kurz, Mar 24 2002
Offset corrected by N. J. A. Sloane, Mar 02 2008. This may require some of the formulas to be adjusted.

A081608 Number of numbers <= n having no 0 in their ternary representation.

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 9, 10, 10, 10, 10, 10, 11, 12, 12, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 16, 17, 18, 18, 18, 18, 18, 19, 20, 20, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 24, 24, 25, 26, 26, 26, 26
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

a(n) + A081607(n) = n+1.

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[If[DigitCount[n,3,0]==0,1,0],{n,0,80}]] (* Harvey P. Dale, Oct 21 2024 *)
  • PARI
    first(n)=my(s,t); vector(n,k, t=Set(digits(k,3)); s+=!!t[1]) \\ Charles R Greathouse IV, Sep 02 2015

A081611 Number of numbers <= n having no 2 in their ternary representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

a(n) is also the size of the subset of [1..n] when numbers are added greedily so as to not contain a 3-term arithmetic progression, i.e., according to A003278: a(n) = the largest k such that A003278(k) <= n. (Cf. A003002, the size of the optimal (largest) 3-free subset of [1..n].) - Shreevatsa R, Oct 19 2009

Crossrefs

Programs

  • Haskell
    a081611 n = a081611_list !! n
    a081611_list = scanl1 (+) a039966_list
    -- Reinhard Zumkeller, Jan 28 2012
    
  • Magma
    R:=PowerSeriesRing(Integers(), 100); Coefficients(R!( (&*[1+x^(3^k): k in [0..5]])/(1-x) )); // G. C. Greubel, Mar 29 2019
    
  • Mathematica
    CoefficientList[Series[Product[1+x^(3^k), {k,0,5}]/(1-x), {x,0,100}], x] (* G. C. Greubel, Mar 29 2019 *)
  • PARI
    {a(n)=local(A,m); if(n<0, 0, m=1; A=1+O(x); while(m<=n, m*=3; A=(1+x)*(1+x+x^2)*subst(A,x,x^3)); polcoeff(A,n))} /* Michael Somos, Aug 31 2006 */
    
  • PARI
    first(n)=my(s,t); vector(n,k,t=Set(digits(k,3)); s+=t[#t]<2) \\ Charles R Greathouse IV, Sep 02 2015
    
  • PARI
    my(x='x+O('x^100)); Vec(prod(k=0,5,1+x^(3^k))/(1-x)) \\ G. C. Greubel, Mar 29 2019
    
  • Python
    from gmpy2 import digits
    def A081611(n):
        l = (s:=digits(n,3)).find('2')
        if l >= 0: s = s[:l]+'1'*(len(s)-l)
        return int(s,2)+1 # Chai Wah Wu, Dec 05 2024
  • Sage
    (product(1+x^(3^k) for k in (0..5))/(1-x)).series(x, 100).coefficients(x, sparse=False) # G. C. Greubel, Mar 29 2019
    

Formula

a(n) + A081610(n) = n+1.
From Michael Somos, Aug 31 2006: (Start)
G.f. A(x) satisfies A(x)=(1+x)*(1+x+x^2)*A(x^3).
G.f.: (1/(1-x))*Product_{k>=0} (1+x^(3^k)).
a(n) = a(n-1) + A039966(n). (End)

A081609 Number of numbers <= n having at least one 1 in their ternary representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

a(n) + A061392(n) = n+1.

Crossrefs

Partial sums of A316829.

Programs

  • PARI
    has(n)=!!setsearch(Set(digits(n,3)),1)
    first(n)=my(s); vector(n,k,s+=has(k)) \\ Charles R Greathouse IV, Sep 02 2015

A326538 a(n) is the numerator of the image of 1/n by the Cantor staircase function.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 3, 3, 3, 3, 23, 1, 5, 5, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 15, 1, 7, 7
Offset: 1

Views

Author

Rémy Sigrist, Jul 12 2019

Keywords

Comments

The Cantor staircase function, say c, maps rational numbers in the interval [0..1] to rational numbers in the interval [0..1], hence this sequence is well defined.
For any n > 0, the binary expansion of c(1/n) is terminating (and A326539(n) is a power of 2) iff the ternary expansion of 1/n is terminating or contains a digit 1.

Examples

			The first terms, alongside c(1/n) and the ternary and binary representation of 1/n and c(1/n), respectively, with periodic part in parentheses, are:
  n   a(n)  c(1/n)  ter(1/n)                bin(c(1/n))
  --  ----  ------  ----------------------  -----------
   1     1       1  1.(0)                   1.(0)
   2     1     1/2  0.(1)                   0.1(0)
   3     1     1/2  0.1(0)                  0.1(0)
   4     1     1/3  0.(02)                  0.(01)
   5     1     1/4  0.(0121)                0.01(0)
   6     1     1/4  0.0(1)                  0.01(0)
   7     1     1/4  0.(010212)              0.01(0)
   8     1     1/4  0.(01)                  0.01(0)
   9     1     1/4  0.01(0)                 0.01(0)
  10     1     1/5  0.(0022)                0.(0011)
  11     3    3/16  0.(00211)               0.0011(0)
  12     1     1/6  0.0(02)                 0.0(01)
  13     1     1/7  0.(002)                 0.(001)
  14     1     1/8  0.(001221)              0.001(0)
  15     1     1/8  0.0(0121)               0.001(0)
  16     1     1/8  0.(0012)                0.001(0)
  17     1     1/8  0.(0011202122110201)    0.001(0)
  18     1     1/8  0.00(1)                 0.001(0)
  19     1     1/8  0.(001102100221120122)  0.001(0)
  20     1     1/8  0.(0011)                0.001(0)
		

Crossrefs

See A326539 for the corresponding denominators.
Cf. A061392.

Programs

  • PARI
    See Links section.

A340619 n appears A006519(n) times.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 13 2021

Keywords

Comments

This sequence has similarities with the Cantor staircase function.
This sequence can be seen as an irregular table where the n-th row contains A006519(n) times the value n.
For any k > 1, the set of points { (n, a(n)), n = 1..A006520(2^k-1) } is symmetric; for example, for k = 3, we have the following configuration:
a(n)
^
| *
| **
| *
| ****
| *
| **
|*
+-------------> n

Examples

			The first rows, alongside A006519(n), are:
    n | n-th row               | A006519(n)
   ---+------------------------+-----------
    1 | 1                      |          1
    2 | 2, 2                   |          2
    3 | 3                      |          1
    4 | 4, 4, 4, 4             |          4
    5 | 5                      |          1
    6 | 6, 6                   |          2
    7 | 7                      |          1
    8 | 8, 8, 8, 8, 8, 8, 8, 8 |          8
    9 | 9                      |          1
   10 | 10, 10                 |          2
		

Crossrefs

See A061392 and A340500 for similar sequences.

Programs

  • Mathematica
    A340619[n_] := Array[n &, Table[BitAnd[BitNot[i - 1], i], {i, 1, n}][[n]]];
    Table[A340619[n], {n, 1, 26}] // Flatten (* Robert P. P. McKone, Jan 19 2021 *)
  • PARI
    concat(apply(v -> vector(2^valuation(v,2), k, v), [1..26]))
    
  • PARI
    a(n) = my(ret=0); forstep(k=logint(n,2),0,-1, if(n > k<<(k-1), ret+=1<Kevin Ryde, Jan 18 2021

Formula

a(A006520(n)) = n.
a(A006520(n)+1) = n+1.
a(n) + a(A006520(2^k-1) + 1 - n) = 2^k for any k > 0 and n = 1..A006520(2^k-1).
a(n) = 2^k + (a(r) if r>0), where k such that k*2^(k-1) < n <= (k+1)*2^k and r = n - (k+2)*2^(k-1). - Kevin Ryde, Jan 18 2021
Showing 1-7 of 7 results.