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

A077267 Number of zeros in base-3 expansion of n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Nov 01 2002

Keywords

Examples

			a(8)=0 since 8 written in base 3 is 22 with 0 zeros;
a(9)=2 since 9 written in base 3 is 100 with 2 zeros;
a(10)=1 since 10 written in base 3 is 101 with 1 zero.
		

Crossrefs

Programs

Formula

a(1)=a(2)=0; a(3n)=a(n)+1; a(3n+1)=a(3n+2)=a(n). a(3^n-2)=a(3^n-1)=0; a(3^n)=n. a(n)=A077266(n, 3).
a(n) + A062756(n) + A081603(n) = A081604(n). - Reinhard Zumkeller, Mar 23 2003
G.f.: (Sum_{k>=0} x^(3^(k+1))/(1 + x^(3^k) + x^(2*3^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005
a(n) = A079978(n) if n < 3, A079978(n) + a(floor(n/3)) otherwise. - Reinhard Zumkeller, Feb 21 2013

Extensions

a(0)=1 added, offset changed to 0 and b-file adjusted by Reinhard Zumkeller, Feb 21 2013
Wrong formula deleted by Reinhard Zumkeller, Feb 21 2013

A081605 Numbers having at least one 0 in their ternary representation.

Original entry on oeis.org

0, 3, 6, 9, 10, 11, 12, 15, 18, 19, 20, 21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 45, 46, 47, 48, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 69, 72, 73, 74, 75, 78, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

Complement of A032924.
A212193(a(n)) <> 0. [Reinhard Zumkeller, May 04 2012]

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a081605 n = a081605_list !! (n-1)
    a081605_list = findIndices (/= 0) a212193_list
    -- Reinhard Zumkeller, May 04 2012
    
  • Mathematica
    Select[Range[0,100],DigitCount[#,3,0]>0&] (* Harvey P. Dale, Aug 10 2021 *)
  • Python
    from itertools import count, islice
    def A081605_gen(): # generator of terms
        a = -1
        for n in count(2):
            b = int(bin(n)[3:],3) + (3**(n.bit_length()-1)-1>>1)
            yield from range(a+1,b)
            a = b
    A081605_list = list(islice(A081605_gen(),30)) # Chai Wah Wu, Oct 13 2023

A081610 Number of numbers <= n having at least one 2 in their ternary representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

a(n) + A081611(n) = n+1. Partial sums of A189820.

Crossrefs

Programs

  • Maple
    num2tern := proc(n) return numboccur(convert(n,base,3),2): end: a:=0: for n from 0 to 80 do a:=a+`if`(num2tern(n)>0,1,0): printf("%d, ",a): od: # Nathaniel Johnston, May 17 2011
  • Mathematica
    Accumulate[Table[If[DigitCount[n,3,2]>0,1,0],{n,0,70}]] (* Harvey P. Dale, Aug 20 2012 *)
  • 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
    
  • Python
    from gmpy2 import digits
    def A081610(n):
        l = (s:=digits(n,3)).find('2')
        if l >= 0: s = s[:l]+'1'*(len(s)-l)
        return n-int(s,2) # Chai Wah Wu, Dec 05 2024

Formula

a(n) ~ n. - Charles R Greathouse IV, Sep 02 2015

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

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
Showing 1-5 of 5 results.