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

A062756 Number of 1's in ternary (base-3) expansion of n.

Original entry on oeis.org

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

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 16 2001

Keywords

Comments

Fixed point of the morphism: 0 ->010; 1 ->121; 2 ->232; ...; n -> n(n+1)n, starting from a(0)=0. - Philippe Deléham, Oct 25 2011

Crossrefs

Cf. A080846, A343785 (first differences).
Cf. A081606 (indices of !=0).
Indices of terms 0..6: A005823, A023692, A023693, A023694, A023695, A023696, A023697.
Numbers of: A077267 (0's), A081603 (2's), A160384 (1's+2's).
Other bases: A000120, A160381, A268643.

Programs

  • Haskell
    a062756 0 = 0
    a062756 n = a062756 n' + m `mod` 2 where (n',m) = divMod n 3
    -- Reinhard Zumkeller, Feb 21 2013
    
  • Mathematica
    Table[Count[IntegerDigits[i, 3], 1], {i, 0, 200}]
    Nest[Join[#, # + 1, #] &, {0}, 5] (* IWABUCHI Yu(u)ki, Sep 08 2012 *)
  • PARI
    a(n)=if(n<1,0,a(n\3)+(n%3)%2) \\ Paul D. Hanna, Feb 24 2006
    
  • PARI
    a(n)=hammingweight(digits(n,3)%2); \\ Ruud H.G. van Tol, Dec 10 2023
    
  • Python
    from sympy.ntheory import digits
    def A062756(n): return digits(n,3)[1:].count(1) # Chai Wah Wu, Dec 23 2022

Formula

a(0) = 0, a(3n) = a(n), a(3n+1) = a(n)+1, a(3n+2) = a(n). - Vladeta Jovovic, Jul 18 2001
G.f.: (Sum_{k>=0} x^(3^k)/(1+x^(3^k)+x^(2*3^k)))/(1-x). In general, the generating function for the number of digits equal to d in the base b representation of n (0 < d < b) is (Sum_{k>=0} x^(d*b^k)/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005 [For d=0, use the above formula with d=b: (Sum_{k>=0} x^(b^(k+1))/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x), adding 1 if you consider the representation of 0 to have one zero digit.]
a(n) = a(floor(n/3)) + (n mod 3) mod 2. - Paul D. Hanna, Feb 24 2006

Extensions

More terms from Vladeta Jovovic, Jul 18 2001

A023699 Numbers with a single 2 in their ternary expansion.

Original entry on oeis.org

2, 5, 6, 7, 11, 14, 15, 16, 18, 19, 21, 22, 29, 32, 33, 34, 38, 41, 42, 43, 45, 46, 48, 49, 54, 55, 57, 58, 63, 64, 66, 67, 83, 86, 87, 88, 92, 95, 96, 97, 99, 100, 102, 103, 110, 113, 114, 115, 119, 122, 123, 124, 126, 127, 129, 130, 135, 136, 138, 139, 144, 145
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Select[ Range[ 162 ], (Count[ IntegerDigits[ #, 3 ], 2 ]==1)& ]
    Select[Range[200],DigitCount[#,3,2]==1&] (* Harvey P. Dale, Jul 26 2023 *)

A291907 Numbers such that the nonzero digits in the base 3 expansion consists of two 1s and one 2.

Original entry on oeis.org

14, 16, 22, 32, 34, 38, 42, 46, 48, 58, 64, 66, 86, 88, 92, 96, 100, 102, 110, 114, 126, 136, 138, 144, 166, 172, 174, 190, 192, 198, 248, 250, 254, 258, 262, 264, 272, 276, 288, 298, 300, 306, 326, 330, 342, 378, 406, 408, 414, 432, 490, 496, 498, 514, 516, 522
Offset: 1

Views

Author

Richard Ehrenborg, Sep 05 2017

Keywords

Comments

If k belongs to this sequence, A060350(k) and A291903(k) are divisible by 3.

Crossrefs

Programs

  • Mathematica
    Select[Range[1000], DigitCount[#, 3, {1, 2}] == {2, 1} &] (* Amiram Eldar, Apr 07 2022 *)

Formula

A023693 INTERSECT A023699. - R. J. Mathar, Nov 10 2017
Showing 1-3 of 3 results.