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

A015518 a(n) = 2*a(n-1) + 3*a(n-2), with a(0)=0, a(1)=1.

Original entry on oeis.org

0, 1, 2, 7, 20, 61, 182, 547, 1640, 4921, 14762, 44287, 132860, 398581, 1195742, 3587227, 10761680, 32285041, 96855122, 290565367, 871696100, 2615088301, 7845264902, 23535794707, 70607384120, 211822152361, 635466457082
Offset: 0

Views

Author

Keywords

Comments

Number of walks of length n between any two distinct vertices of the complete graph K_4. - Paul Barry and Emeric Deutsch, Apr 01 2004
For n >= 1, a(n) is the number of integers k, 1 <= k <= 3^(n-1), whose ternary representation ends in an even number of zeros (see A007417). - Philippe Deléham, Mar 31 2004
Form the digraph with matrix A=[0,1,1,1;1,0,1,1;1,1,0,1;1,0,1,1]. A015518(n) corresponds to the (1,3) term of A^n. - Paul Barry, Oct 02 2004
The same sequence may be obtained by the following process. Starting a priori with the fraction 1/1, the denominators of fractions built according to the rule: add top and bottom to get the new bottom, add top and 4 times the bottom to get the new top. The limit of the sequence of fractions is 2. - Cino Hilliard, Sep 25 2005
(A046717(n))^2 + (2*a(n))^2 = A046717(2n). E.g., A046717(3) = 13, 2*a(3) = 14, A046717(6) = 365. 13^2 + 14^2 = 365. - Gary W. Adamson, Jun 17 2006
For n >= 2, number of ordered partitions of n-1 into parts of sizes 1 and 2 where there are two types of 1 (singletons) and three types of 2 (twins). For example, the number of possible configurations of families of n-1 male (M) and female (F) offspring considering only single births and twins, where the birth order of M/F/pair-of-twins is considered and there are three types of twins; namely, both F, both M, or one F and one M - where birth order within a pair of twins itself is disregarded. In particular, for a(3)=7, two children could be either: (1) F, then M; (2) M, then F; (3) F,F; (4) M,M; (5) F,F twins; (6) M,M twins; or (7) M,F twins (emphasizing that birth order is irrelevant here when both/all children are the same gender and when two children are within the same pair of twins). - Rick L. Shepherd, Sep 18 2004
a(n) is prime for n = {2, 3, 5, 7, 13, 23, 43, 281, 359, ...}, where only a(2) = 2 corresponds to a prime of the form (3^k - 1)/4. All prime terms, except a(2) = 2, are the primes of the form (3^k + 1)/4. Numbers k such that (3^k + 1)/4 is prime are listed in A007658. Note that all prime terms have prime indices. Prime terms are listed in A111010. - Alexander Adamchuk, Nov 19 2006
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-2, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n)=charpoly(A,1). - Milan Janjic, Jan 26 2010
Select an odd size subset S from {1,2,...,n}, then select an even size subset from S. - Geoffrey Critzer, Mar 02 2010
a(n) is the number of ternary sequences of length n where the numbers of (0's, 1's) are (even, odd) respectively, and, by symmetry, the number of such sequences where those numbers are (odd, even) respectively. A122983 covers (even, even), and A081251 covers (odd, odd). - Toby Gottfried, Apr 18 2010
An elephant sequence, see A175654. For the corner squares just one A[5] vector, with decimal value 341, leads to this sequence (without the leading 0). For the central square this vector leads to the companion sequence A046717 (without the first leading 1). - Johannes W. Meijer, Aug 15 2010
Let R be the commutative algebra resulting from adjoining the elements of the Klein four-group to the integers (equivalently, K = Z[x,y,z]/{x*y - z, y*z - x, x*z - y, x^2 - 1, y^2 - 1, z^2 - 1}). Then a(n) is equal to the coefficients of x, y, and z in the expansion of (x + y + z)^n. - Joseph E. Cooper III (easonrevant(AT)gmail.com), Nov 06 2010
Pisano period lengths: 1, 2, 2, 4, 4, 2, 6, 8, 2, 4, 10, 4, 6, 6, 4, 16, 16, 2, 18, 4, ... - R. J. Mathar, Aug 10 2012
The ratio a(n+1)/a(n) converges to 3 as n approaches infinity. - Felix P. Muga II, Mar 09 2014
This is a divisibility sequence, also the values of Chebyshev polynomials, and also the number of ways of packing a 2 X n-1 rectangle with dominoes and unit squares. - R. K. Guy, Dec 16 2016
For n>0, gcd(a(n),a(n+1))=1. - Kengbo Lu, Jul 02 2020

References

  • John Derbyshire, Prime Obsession, Joseph Henry Press, April 2004, see p. 16.

Crossrefs

a(n) = A080926(n-1) + 1 = (1/3)*A054878(n+1) = (1/3)*abs(A084567(n+1)).
First differences of A033113 and A039300.
Partial sums of A046717.
The following sequences (and others) belong to the same family: A000129, A001333, A002532, A002533, A002605, A015518, A015519, A026150, A046717, A063727, A083098, A083099, A083100, A084057.
Cf. A046717.

Programs

  • Magma
    [Round(3^n/4): n in [0..30]]; // Vincenzo Librandi, Jun 24 2011
    
  • Mathematica
    Table[(3^n-(-1)^n)/4,{n,0,30}] (* Alexander Adamchuk, Nov 19 2006 *)
  • Maxima
    a(n):= round(3^n/4)$ /* Dimitri Papadopoulos, Nov 28 2023 */
  • PARI
    a(n)=round(3^n/4)
    
  • Python
    for n in range(0, 20): print(int((3**n-(-1)**n)/4), end=', ') # Stefano Spezia, Nov 30 2018
    
  • Sage
    [round(3^n/4) for n in range(0,27)]
    

Formula

G.f.: x/((1+x)*(1-3*x)).
a(n) = (3^n - (-1)^n)/4 = floor(3^n/4 + 1/2).
a(n) = 3^(n-1) - a(n-1). - Emeric Deutsch, Apr 01 2004
E.g.f.: (exp(3*x) - exp(-x))/4. Second inverse binomial transform of (5^n-1)/4, A003463. Inverse binomial transform for powers of 4, A000302 (when preceded by 0). - Paul Barry, Mar 28 2003
a(n) = Sum_{k=0..floor(n/2)} C(n, 2k+1)*2^(2k). - Paul Barry, May 14 2003
a(n) = Sum_{k=1..n} binomial(n, k)*(-1)^(n+k)*4^(k-1). - Paul Barry, Apr 02 2003
a(n+1) = Sum_{k=0..floor(n/2)} binomial(n-k, k)*2^(n-2*k)*3^k. - Paul Barry, Jul 13 2004
a(n) = U(n-1, i/sqrt(3))(-i*sqrt(3))^(n-1), i^2=-1. - Paul Barry, Nov 17 2003
G.f.: x*(1+x)^2/(1 - 6*x^2 - 8*x^3 - 3*x^4) = x(1+x)^2/characteristic polynomial(x^4*adj(K_4)(1/x)). - Paul Barry, Feb 03 2004
a(n) = sum_{k=0..3^(n-1)} A014578(k) = -(-1)^n*A014983(n) = A051068(3^(n-1)), for n > 0. - Philippe Deléham, Mar 31 2004
E.g.f.: exp(x)*sinh(2*x)/2. - Paul Barry, Oct 02 2004
a(2*n+1) = A054880(n) + 1. - M. F. Hasler, Mar 20 2008
2*a(n) + (-1)^n = A046717(n). - M. F. Hasler, Mar 20 2008
a(n) = ((1+sqrt(4))^n - (1-sqrt(4))^n)/4. - Al Hakanson (hawkuu(AT)gmail.com), Dec 31 2008
a(n) = abs(A014983(n)). - Zerinvary Lajos, May 28 2009
a(n) = round(3^n/4). - Mircea Merca, Dec 28 2010
a(n) = Sum_{k=1,3,5,...} binomial(n,k)*2^(k-1). - Geoffrey Critzer, Mar 02 2010
From Sergei N. Gladkovskii, Jul 19 2012: (Start)
G.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - 1/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + 1/G(k+1)))))); (continued fraction).
E.g.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - (2*k+1)/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + (2*k+2)/G(k+1)))))); (continued fraction). (End)
G.f.: G(0)*x/(2*(1-x)), where G(k) = 1 + 1/(1 - x*(4*k-1)/(x*(4*k+3) - 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 26 2013
a(n+1) = Sum_{k = 0..n} A238801(n,k)*2^k. - Philippe Deléham, Mar 07 2014
a(n) = (-1)^(n-1)*Sum_{k=0..n-1} A135278(n-1,k)*(-4)^k = (-1)^(n-1)*Sum_{k=0..n-1} (-3)^k. Equals (-1)^(n-1)*Phi(n,-3), where Phi is the cyclotomic polynomial when n is an odd prime. (For n > 0.) - Tom Copeland, Apr 14 2014
a(n) = 2*A006342(n-1) - n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Nov 30 2018
a(n) = 2*A033113(n-2) + n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Aug 16 2019
a(2*k) = 2*A002452(k), a(2*k+1) = A066443(k). - Yuchun Ji, Aug 14 2019
a(n+1) = 2*Sum_{k=0..n} a(k) if n odd, and 1 + 2*Sum_{k=0..n} a(k) if n even. - Kengbo Lu, May 30 2020
a(n) = F(n) + Sum_{k=1..(n-1)} a(k)*L(n-k), for F(n) and L(n) the Fibonacci and Lucas numbers. - Kengbo Lu and Greg Dresden, Jun 05 2020
From Kengbo Lu, Jun 11 2020: (Start)
a(n) = A002605(n) + Sum_{k = 1..n-2} a(k)*A002605(n-k-1).
a(n) = A006130(n-1) + Sum_{k = 1..n-1} a(k)*A006130(n-k-1). (End)
a(2n) = Sum_{i>=0, j>=0} binomial(n-j-1,i)*binomial(n-i-1,j)* 2^(2n-2i-2j-1)* 3^(i+j). - Kengbo Lu, Jul 02 2020
a(n) = 3*a(n-1) - (-1)^n. - Dimitri Papadopoulos, Nov 28 2023
G.f.: x/((1 + x)*(1 - 3*x)) = Sum_{n >= 0} x^(n+1) * Product_{k = 1..n} (k + 3*x + 1)(1 + k*x) (a telescoping series). Cf. A007482. - Peter Bala, May 08 2024
From Peter Bala, Jun 29 2025: (Start)
For n >= 1, a(n+1) = 2^n * hypergeom([1/2 - (1/2)*n, -(1/2)*n], [-n], -3).
G.f. A(x) = x*exp(Sum_{n >= 1} a(2*n)/a(n)*x^n/n) = x + 2*x^2 + 7*x^3 + 20*x^4 + ....
sqrt(A(x)/x) is the g.f. of A002426.
The following series telescope:
Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)) = -1; Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*a(n+2)*a(n+3)) = -1/98.
In general, for k >= 0, Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*...*a(n+2*k+1)) = -1/((a(1)*a(2)*...*a(2*k+1))*a(2*k+1)).
Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)) = 1/4; Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)* a(n+3)*a(n+4)) = 1/5600.
In general, for k >= 1, Sum_{n >= 1} 3^n/(a(n)*a(n+1)*...*a(n+2*k)) = 1/((a(1)*a(2)*...*a(2*k))*a(2*k)). (End)

Extensions

More terms from Emeric Deutsch, Apr 01 2004
Edited by Ralf Stephan, Aug 30 2004

A051064 3^a(n) exactly divides 3n. Or, 3-adic valuation of 3n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) is the Hamming distance between n and n-1 in ternary representation. - Philippe Deléham, Mar 29 2004
3^a(n) divides 4^n-1. - Benoit Cloitre, Oct 25 2004
Generalized Ruler Function for k=3. - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
a(A007417(n)) is odd and a(A145204(n)) is even. - Reinhard Zumkeller, May 23 2013
First n terms comprise least cubefree word of length n using positive integers, where "cubefree" means that the word contains no three consecutive identical subwords; e.g., 1 contains no cube; 11 contains no cube; 111 does but 112 does not; ... 1,1,2,1,1,2,1,1,1 does, and 1,1,2,1,1,2,1,1,2 does, but 1,1,2,1,1,2,1,1,3 does not, etc. - Clark Kimberling, Sep 10 2013
The sequence is invariant under the "lower trim" operator: remove all ones, and subtract one from each remaining term. - Franklin T. Adams-Watters, May 25 2017
a(n) is the dimension in which the coordinates of the vertices n-1 and n differ in the ternary reflected Gray code. - Arie Bos, Jul 12 2023
The number of powers of 3 that divide n. - Amiram Eldar, Mar 29 2025

Examples

			3^2 | 3*6 = 18, so a(6) = 2.
		

References

  • Letter from Gary W. Adamson to N. J. A. Sloane concerning Prouhet-Thue-Morse sequence, Nov. 11, 1999.

Crossrefs

Cf. A007949.
Partial sums give A004128.
Cf. A254046.

Programs

  • Haskell
    a051064 = (+ 1) . length .
                      takeWhile (== 3) . dropWhile (== 2) . a027746_row
    -- Reinhard Zumkeller, May 23 2013
    
  • Maple
    seq(1+padic:-ordp(n,3), n=1..100); # Robert Israel, Aug 07 2014
  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 1, 2}, 2 -> {1, 1, 3}, 3 -> {1, 1, 4}, 4 -> {1, 1, 5}})]}], {1}, 5] (* Robert G. Wilson v, Mar 03 2005 *)
    Table[ IntegerExponent[3n, 3], {n, 1, 105}] (* Jean-François Alcover, Oct 10 2011 *)
  • PARI
    a(n)=if(n<1,0,1+valuation(n,3))
    
  • Python
    def A051064(n):
        c = 1
        a, b = divmod(n,3)
        while b == 0:
            a, b = divmod(a,3)
            c += 1
        return c # Chai Wah Wu, Apr 18 2022

Formula

a(n) = A007949(n) + 1 = A004128(n) - A004128(n-1).
Multiplicative with a(p^e) = e+1 if p = 3; 1 if p <> 3. - Vladeta Jovovic, Aug 24 2002
G.f.: Sum_{k>=0} x^3^k/(1-x^3^k). - Ralf Stephan, Apr 12 2002
Fixed point of the morphism: 1 -> 112; 2 -> 113; 3 -> 114; 4 -> 115; ...; starting from a(1) = 1. a(3n+1) = a(3n+2) = 1; a(3n) = 1 + a(n). - Philippe Deléham, Mar 29 2004
a(n) = (-1)*Sum_{d divides n} mu(3d)*tau(n/d). - Benoit Cloitre, Jun 21 2007
Dirichlet g.f.: zeta(s)/(1-1/3^s). - R. J. Mathar, Jun 13 2011
a(n) = (1/2)*(3 - A053735(n) + A053735(n-1)) for n >= 1. - Tom Edgar, Aug 06 2014
a(n) = A007949(3n). - Cyril Damamme, Aug 04 2015
a(2n) = a(n), a(2n-1) = A254046(n). - Cyril Damamme, Aug 04 2015
G.f. A(x) satisfies: A(x) = A(x^3) + x/(1 - x). - Ilya Gutkovskiy, May 03 2019
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/2. - Amiram Eldar, Sep 11 2020 [corrected by Vaclav Kotesovec, Jun 25 2024, see also A004128]
a(n) = tau(n)/(tau(3*n) - tau(n)), where tau(n) = A000005(n). - Peter Bala, Jan 06 2021
G.f.: Sum_{i>=1, j>=0} x^(i*3^j). - Seiichi Manyama, Mar 23 2025
Conjecture: a(n) = A007949(A000045(4*n)), all other 3-adic quadrisections A007949(A000045(.))=0. [Lengyel?]. - R. J. Mathar, Jun 28 2025

Extensions

More terms from James Sellers, Dec 11 1999
More terms from Vladeta Jovovic, Aug 24 2002

A145204 Numbers whose representation in base 3 (A007089) ends in an odd number of zeros.

Original entry on oeis.org

0, 3, 6, 12, 15, 21, 24, 27, 30, 33, 39, 42, 48, 51, 54, 57, 60, 66, 69, 75, 78, 84, 87, 93, 96, 102, 105, 108, 111, 114, 120, 123, 129, 132, 135, 138, 141, 147, 150, 156, 159, 165, 168, 174, 177, 183, 186, 189, 192, 195, 201, 204, 210, 213, 216, 219, 222, 228, 231
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 04 2008

Keywords

Comments

Previous name: Complement of A007417.
Also numbers having infinitary divisor 3, or the same, having factor 3 in their Fermi-Dirac representation as product of distinct terms of A050376. - Vladimir Shevelev, Mar 18 2013
For n > 1: where even terms occur in A051064. - Reinhard Zumkeller, May 23 2013
If we exclude a(1) = 0, these are numbers whose squarefree part is divisible by 3, which can be partitioned into numbers whose squarefree part is congruent to 3 mod 9 (A055041) and 6 mod 9 (A055040) respectively. - Peter Munn, Jul 14 2020
The inclusion of 0 as a term might be viewed as a cultural preference: if we habitually wrote numbers enclosed in brackets and then used a null string of digits for zero, the natural number sequence in ternary would be [], [1], [2], [10], [11], [12], [20], ... . - Peter Munn, Aug 02 2020
The asymptotic density of this sequence is 1/4. - Amiram Eldar, Sep 20 2020

Crossrefs

Subsequence of A008585, A028983.
Subsequences: A016051, A055040, A055041, A329575.
Cf. A007089, A007417 (complement), A050376, A182581 (characteristic function).
Positions of 0s in A014578.
Excluding 0: the positions of odd numbers in A007949; equivalently, of even numbers in A051064; symmetric difference of A003159 and A036668.
Related to A042964 via A052330.
Related to A036554 via A064614.

Programs

  • Haskell
    a145204 n = a145204_list !! (n-1)
    a145204_list = 0 : map (+ 1) (findIndices even a051064_list)
    -- Reinhard Zumkeller, May 23 2013
    
  • Maple
    isA145204 := proc(n) local d, c;
    if n = 0 then return true fi;
    d := A007089(n); c := 0;
    while irem(d, 10) = 0 do c := c+1; d := iquo(d, 10) od;
    type(c, odd) end:
    select(isA145204, [$(0..231)]); # Peter Luschny, Aug 05 2020
  • Mathematica
    Select[ Range[0, 235], (# // IntegerDigits[#, 3]& // Split // Last // Count[#, 0]& // OddQ)&] (* Jean-François Alcover, Mar 18 2013 *)
    Join[{0}, Select[Range[235], OddQ @ IntegerExponent[#, 3] &]] (* Amiram Eldar, Sep 20 2020 *)
  • Python
    import numpy as np
    def isA145204(n):
        if n == 0: return True
        c = 0
        d = int(np.base_repr(n, base = 3))
        while d % 10 == 0:
            c += 1
            d //= 10
        return c % 2 == 1
    print([n for n in range(231) if isA145204(n)]) # Peter Luschny, Aug 05 2020
    
  • Python
    from sympy import integer_log
    def A145204(n):
        if n == 1: return 0
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n-1+sum(((m:=x//9**i)-2)//3+(m-1)//3+2 for i in range(integer_log(x,9)[0]+1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 15 2025

Formula

a(n) = 3 * A007417(n-1) for n > 1.
A014578(a(n)) = 0.
For n > 1, A007949(a(n)) mod 2 = 1. [Edited by Peter Munn, Aug 02 2020]
{a(n) : n >= 2} = {A052330(A042964(k)) : k >= 1} = {A064614(A036554(k)) : k >= 1}. - Peter Munn, Aug 31 2019 and Dec 06 2020

Extensions

New name using a comment of Vladimir Shevelev by Peter Luschny, Aug 05 2020

A339746 Positive integers of the form 2^i*3^j*k, gcd(k,6)=1, and i == j (mod 3).

Original entry on oeis.org

1, 5, 6, 7, 8, 11, 13, 17, 19, 23, 25, 27, 29, 30, 31, 35, 36, 37, 40, 41, 42, 43, 47, 48, 49, 53, 55, 56, 59, 61, 64, 65, 66, 67, 71, 73, 77, 78, 79, 83, 85, 88, 89, 91, 95, 97, 101, 102, 103, 104, 107, 109, 113, 114, 115, 119, 121, 125, 127, 131, 133, 135
Offset: 1

Views

Author

Griffin N. Macris, Dec 15 2020

Keywords

Comments

From Peter Munn, Mar 16 2021: (Start)
The positive integers in the multiplicative subgroup of the positive rationals generated by 8, 6, and A215848 (primes greater than 3).
This subgroup, denoted H, has two cosets: 2H = (1/3)H and 3H = (1/2)H. It follows that the sequence is one part of a 3-part partition of the positive integers with the property that each part's terms are half the even terms of one of the other parts and also one third of the multiples of 3 in the remaining part.
(End)
Positions of multiples of 3 in A276085 (and in A276075). Because A276085 is completely additive, this is closed under multiplication: if m and n are in the sequence then so is m*n. - Antti Karttunen, May 27 2024
The coset sequences mentioned in Peter Munn's comment above are A373261 and A373262. - Antti Karttunen, Jun 04 2024

Crossrefs

Sequences of positive integers in a multiplicative subgroup of positive rationals generated by a set S and A215848: S={}: A007310, S={6}: A064615, S={3,4}: A003159, S={2,9}: A007417, S={4,6}: A036668, S={3,8}: A191257, S={4,9}: A339690, S={6,8}: this sequence.
Positions of 0's in A373153, positions of multiples of 3 in A276085 and in A372576.
Cf. A372573 (characteristic function), A373261, A373262.
Sequences giving positions of multiples of k in A276085, for k=2, 3, 4, 5, 8, 27, 3125: A003159, this sequence, A369002, A373140, A373138, A377872, A377878.
Cf. also A332820, A373992, A383288.

Programs

  • Maple
    N:= 1000: # for terms <= N
    R:= {}:
    for k1 from 0 to floor(N/6) do
      for k0 in [1,5] do
        k:= k0 + 6*k1;
        for j from 0 while 3^j*k <= N do
          for i from (j mod 3) by 3 do
            x:= 2^i * 3^j * k;
            if x > N then break fi;
            R:= R union {x}
    od od od od:
    sort(convert(R,list)); # Robert Israel, Apr 08 2021
  • Mathematica
    Select[Range[130], Mod[IntegerExponent[#, 2] - IntegerExponent[#, 3], 3] == 0 &]
  • PARI
    isA339746 = A372573; \\ Antti Karttunen, Jun 04 2024
    
  • Python
    from sympy import factorint
    def ok(n):
      f = factorint(n, limit=4)
      i, j = 0 if 2 not in f else f[2], 0 if 3 not in f else f[3]
      return (i-j)%3 == 0
    def aupto(limit): return [m for m in range(1, limit+1) if ok(m)]
    print(aupto(200)) # Michael S. Branicky, Mar 26 2021
    
  • Python
    from itertools import count
    def A339746(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c = n+x
            for i in range(x.bit_length()+1):
                i2 = 1<x:
                        break
                    m = x//k
                    c -= (m-1)//6+(m-5)//6+2
            return c
        return bisection(f,n,n) # Chai Wah Wu, Feb 12 2025

Formula

a(n) ~ (91/43)*n.

A014578 Binary expansion of Thue constant (or Roth's constant).

Original entry on oeis.org

0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1
Offset: 0

Keywords

Comments

a(0)=0; to construct the sequence start with a(1)=1, then concatenate twice and change the last term 1->0 giving 1,1,0. Concatenate those 3 terms twice giving 1,1,0,1,1,0,1,1,0, change the last term 0->1 giving 1,1,0,1,1,0,1,1,1. Concatenate those 9 terms twice and change the last term 1->0, etc. - Benoit Cloitre, Feb 09 2003
It is probably my fault if this constant is misattributed. It was "computed" circa 1971 by a very simple Life pattern (as a diagonal row of blinkers), an obvious case of the (Thue-Siegel-)Roth criterion for transcendence, since the error after 3^n bits is ~2^-3^(n+1) = O(denominator^-3). I probably should have called it Roth's constant. - Bill Gosper, Mar 19 2004
a(0) = 0; then fixed point of the morphism 1->110, 0->111, starting with a(1) = 1. - Philippe Deléham, Mar 21 2004
Characteristic function of A007417, i.e., a(n) = 1 if n is in A007417 and a(n) = 0 otherwise. - Philippe Deléham, Mar 21 2004
Multiplicative with a(3^e) = (e+1)%2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 10 2005
a(A145204(n)) = 0, a(A007417(n)) = 1. - Reinhard Zumkeller, Oct 04 2008
1 if the ternary representation of n has an even number of trailing zeros. - Ralf Stephan, Sep 02 2013

Examples

			Start: 1
Rules:
  1 --> 110
  0 --> 111
-------------
0:   (#=1)
  1
1:   (#=3)
  110
2:   (#=9)
  110110111
3:   (#=27)
  110110111110110111110110110
4:   (#=81)
  110110111110110111110110110110110111110110111110110110110110111110110111110110111
- _Joerg Arndt_, Jul 06 2011
		

Crossrefs

Cf. Thue-Morse or parity constant A010060.
Cf. A154271.

Programs

  • Mathematica
    Nest[ Flatten[ # /. {0 -> {1, 1, 1}, 1 -> {1, 1, 0}}] &, {0}, 6] (* Robert G. Wilson v, Mar 09 2005 *)
  • PARI
    a(n)=if(n<1,0,sum(k=0,ceil(log(n)/log(3)),(-1)^k*(floor(n/3^k)-floor((n-1)/3^k))));
    
  • PARI
    A014578(n) = if(!n,n,valuation(n, 3)%2==0); \\ Ralf Stephan, Sep 02 2013, edited for the term a(0)=0 - Antti Karttunen, May 28 2024
    
  • Python
    from sympy import multiplicity
    def A014578(n): return multiplicity(3,n)&1^1 if n else 0 # Chai Wah Wu, Jan 28 2025

Formula

a(0)=0; for n>=1, a(n)=sum(k>=0, (-1)^k*(floor(n/3^k)-floor((n-1)/3^k))). - Benoit Cloitre, Jun 03 2003
a(0)=0, a(3k)=1-a(k); a(3k+1)=a(3k+2)=1. - Benoit Cloitre, Mar 19 2004
Sum_{k=0..3^n} a(k) = A015518(n+1) = (-1)^n*A014983(n+1). - Philippe Deléham, Mar 31 2004
a(n) = 1 - A007949(n) mod 2 for n>0. - Reinhard Zumkeller, Oct 04 2008
Let T(x) be the g.f., then T(x) + T(x^3) = x/(1-x). - Joerg Arndt, May 11 2010
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/4. - Amiram Eldar, Jul 13 2020

A026225 Numbers of the form 3^i * (3k+1).

Original entry on oeis.org

1, 3, 4, 7, 9, 10, 12, 13, 16, 19, 21, 22, 25, 27, 28, 30, 31, 34, 36, 37, 39, 40, 43, 46, 48, 49, 52, 55, 57, 58, 61, 63, 64, 66, 67, 70, 73, 75, 76, 79, 81, 82, 84, 85, 88, 90, 91, 93, 94, 97, 100, 102, 103, 106, 108, 109, 111, 112, 115
Offset: 1

Keywords

Comments

Old name: a(n) = (1/3)*(s(n+1) - 1), where s = A026224.
Conjectures based on old name: these are numbers of the form (3*i+1)*3^j; see A182828, and they comprise the complement of A026179, except for the initial 1 in A026179.
From Peter Munn, Mar 17 2022: (Start)
Numbers with an even number of prime factors of the form 3k-1 counting repetitions.
Numbers whose squarefree part is congruent to 1 modulo 3 or 3 modulo 9.
The integers in an index 2 subgroup of the positive rationals under multiplication. As such the sequence is closed under multiplication and - where the result is an integer - under division; also for any positive integer k not in the sequence, the sequence's complement is generated by dividing by k the terms that are multiples of k.
Alternatively, the sequence can be viewed as an index 2 subgroup of the positive integers under the commutative binary operation A059897(.,.).
Viewed either way, the sequence corresponds to a subgroup of the quotient group derived in the corresponding way from A055047. (End)
The asymptotic density of this sequence is 1/2. - Amiram Eldar, Apr 03 2022
Is this A026140 shifted right? - R. J. Mathar, Jun 24 2025

Crossrefs

Elements of array A182828 in ascending order.
Union of A055041 and A055047.
Other subsequences: A007645 (primes), A352274.
Symmetric difference of A003159 and A225838; of A007417 and A189716.

Programs

  • Mathematica
    a[b_] := Table[Mod[n/b^IntegerExponent[n, b], b], {n, 1, 160}]
    p[b_, d_] := Flatten[Position[a[b], d]]
    p[3, 1]  (* A026225 *)
    p[3, 2] (* A026179 without initial 1 *)
    (* Clark Kimberling, Oct 19 2016 *)
  • PARI
    isok(m) = core(m) % 3 == 1 || core(m) % 9 == 3; \\ Peter Munn, Mar 17 2022
    
  • Python
    from sympy import integer_log
    def A026225(n):
        def f(x): return n+x-sum(((x//3**i)-1)//3+1 for i in range(integer_log(x,3)[0]+1))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 15 2025

Formula

From Peter Munn, Mar 17 2022: (Start)
{a(n) : n >= 1} = {m : A001222(A343430(m)) == 0 (mod 2)}.
{a(n) : n >= 1} = {A055047(m) : m >= 1} U {3*A055047(m) : m >= 1}.
{a(n) : n >= 1} = {A352274(m) : m >= 1} U {A352274(m)/10 : m >= 1, 10 divides A352274(m)}. (End)

Extensions

New name from Peter Munn, Mar 17 2022

A342051 Numbers k which have an even number of trailing zeros in their primorial base representation A049345(k).

Original entry on oeis.org

1, 3, 5, 6, 7, 9, 11, 12, 13, 15, 17, 18, 19, 21, 23, 24, 25, 27, 29, 31, 33, 35, 36, 37, 39, 41, 42, 43, 45, 47, 48, 49, 51, 53, 54, 55, 57, 59, 61, 63, 65, 66, 67, 69, 71, 72, 73, 75, 77, 78, 79, 81, 83, 84, 85, 87, 89, 91, 93, 95, 96, 97, 99, 101, 102, 103
Offset: 1

Author

Amiram Eldar, Feb 26 2021

Keywords

Comments

Numbers k such that A276084(k) is even.
The number of terms not exceeding A002110(m) for m>=1 is A002110(m) * (1 - Sum_{k=1..m}(-1)^k/A002110(k)) = 1, 4, 19, 134, 1473, 19150, 325549 ...
The asymptotic density of this sequence is Sum_{k>=0} (-1)^k/A002110(k) = 0.637693... = 1 - A132120.
Also Heinz numbers of partitions with odd least gap. The least gap (mex or minimal excludant) of a partition is the least positive integer that is not a part. The Heinz number of a partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k), giving a bijective correspondence between positive integers and integer partitions. - Gus Wiseman, Apr 23 2021

Examples

			1 is a term since A049345(1) = 1 has 0 trailing zero.
6 is a term since A049345(6) = 100 has 2 trailing zeros.
From _Gus Wiseman_, Apr 23 2021: (Start)
The sequence of terms together with their prime indices begins:
     1: {}           25: {3,3}          51: {2,7}
     3: {2}          27: {2,2,2}        53: {16}
     5: {3}          29: {10}           54: {1,2,2,2}
     6: {1,2}        31: {11}           55: {3,5}
     7: {4}          33: {2,5}          57: {2,8}
     9: {2,2}        35: {3,4}          59: {17}
    11: {5}          36: {1,1,2,2}      61: {18}
    12: {1,1,2}      37: {12}           63: {2,2,4}
    13: {6}          39: {2,6}          65: {3,6}
    15: {2,3}        41: {13}           66: {1,2,5}
    17: {7}          42: {1,2,4}        67: {19}
    18: {1,2,2}      43: {14}           69: {2,9}
    19: {8}          45: {2,2,3}        71: {20}
    21: {2,4}        47: {15}           72: {1,1,1,2,2}
    23: {9}          48: {1,1,1,1,2}    73: {21}
    24: {1,1,1,2}    49: {4,4}          75: {2,3,3}
(End)
		

Crossrefs

Complement of A342050.
A099788 is subsequence.
Analogous sequences: A000201 (Zeckendorf representation), A003159 (binary), A007417 (ternary), A232744 (factorial base).
The version for reversed binary expansion is A121539.
Positions of odd terms in A257993.
A000070 counts partitions with a selected part.
A056239 adds up prime indices, row sums of A112798.
A073491 lists numbers with gap-free prime indices.
A079067 counts gaps in prime indices.
A238709 counts partitions by sum and least difference.
A339662 gives greatest gap in prime indices.

Programs

  • Mathematica
    seq[max_] := Module[{bases = Prime@Range[max, 1, -1], nmax}, nmax = Times @@ bases - 1; Select[Range[nmax], EvenQ @ LengthWhile[Reverse @ IntegerDigits[#, MixedRadix[bases]], #1 == 0 &] &]]; seq[4]
    Select[Range[100],OddQ[Min@@Complement[Range[PrimeNu[#]+1],PrimePi/@First/@FactorInteger[#]]]&] (* Gus Wiseman, Apr 23 2021 *)

A055047 Numbers of the form 9^i*(3*j+1).

Original entry on oeis.org

1, 4, 7, 9, 10, 13, 16, 19, 22, 25, 28, 31, 34, 36, 37, 40, 43, 46, 49, 52, 55, 58, 61, 63, 64, 67, 70, 73, 76, 79, 81, 82, 85, 88, 90, 91, 94, 97, 100, 103, 106, 109, 112, 115, 117, 118, 121, 124, 127, 130, 133, 136, 139, 142, 144, 145, 148, 151, 154, 157, 160, 163
Offset: 1

Author

N. J. A. Sloane, Jun 01 2000

Keywords

Comments

The numbers not of the form 2x^2+3y^2+3z^2.
Also values of n such that numbers of the form x^2+n*y^2 for some integers x, y cannot have prime factor of 3 raised to an odd power. - V. Raman, Dec 18 2013
Numbers whose squarefree part is congruent to 1 modulo 3. - Peter Munn, May 17 2020

Crossrefs

Intersection of A007417 and A189715.
Complement of A055048 with respect to A007417.
Complement of A055040 with respect to A189715.

Programs

  • Mathematica
    A055047Q[k_] := Mod[k/9^IntegerExponent[k, 9], 3] == 1;
    Select[Range[300], A055047Q] (* Paolo Xausa, Mar 20 2025 *)
  • PARI
    is(n)=n/=9^valuation(n,9); n%3==1 \\ Charles R Greathouse IV and V. Raman, Dec 19 2013
    
  • Python
    from sympy import integer_log
    def A055047(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum((x//9**i-1)//3+1 for i in range(integer_log(x,9)[0]+1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

a(n) = 8n/3 + O(log n). - Charles R Greathouse IV, Dec 19 2013
a(n) = A055041(n)/3. - Peter Munn, May 17 2020

A325424 Complement of A036668: numbers not of the form 2^i*3^j*k, i + j even, (k,6) = 1.

Original entry on oeis.org

2, 3, 8, 10, 12, 14, 15, 18, 21, 22, 26, 27, 32, 33, 34, 38, 39, 40, 46, 48, 50, 51, 56, 57, 58, 60, 62, 69, 70, 72, 74, 75, 82, 84, 86, 87, 88, 90, 93, 94, 98, 104, 105, 106, 108, 110, 111, 118, 122, 123, 126, 128, 129, 130, 132, 134, 135, 136, 141, 142
Offset: 1

Author

Clark Kimberling, Apr 26 2019

Keywords

Comments

These are the numbers 2x and 3x as x ranges through the numbers in A036668.
Numbers whose squarefree part is divisible by exactly one of {2, 3}. - Peter Munn, Aug 24 2020
The asymptotic density of this sequence is 5/12. - Amiram Eldar, Sep 20 2020

Crossrefs

Symmetric difference of: A003159 and A007417; A036554 and A145204\{0}.

Programs

  • Mathematica
    a = {1}; Do[AppendTo[a, NestWhile[# + 1 &, Last[a] + 1, Apply[Or,
    Map[MemberQ[a, #] &, Select[Flatten[{#/3, #/2}],
    IntegerQ]]] &]], {150}]; a     (* A036668 *)
    Complement[Range[Last[a]], a]  (* A325424 *)
    (* Peter J. C. Moses, Apr 23 2019 *)
  • Python
    from itertools import count
    def A325424(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c = n
            for i in range(x.bit_length()+1):
                i2 = 1<x:
                        break
                    m = x//k
                    c += (m-1)//6+(m-5)//6+2
            return c
        return bisection(f,n,n) # Chai Wah Wu, Jan 28 2025

Formula

(2 * {A036668}) union (3 * {A036668}). - Sean A. Irvine, May 19 2019

A339690 Positive integers of the form 4^i*9^j*k with gcd(k,6)=1.

Original entry on oeis.org

1, 4, 5, 7, 9, 11, 13, 16, 17, 19, 20, 23, 25, 28, 29, 31, 35, 36, 37, 41, 43, 44, 45, 47, 49, 52, 53, 55, 59, 61, 63, 64, 65, 67, 68, 71, 73, 76, 77, 79, 80, 81, 83, 85, 89, 91, 92, 95, 97, 99, 100, 101, 103, 107, 109, 112, 113, 115, 116, 117, 119, 121
Offset: 1

Author

Griffin N. Macris, Dec 13 2020, and Peter Munn, Feb 03 2021

Keywords

Comments

Positive integers that survive sieving by the rule: if m appears then 2m, 3m and 6m do not.
Numbers whose squarefree part is congruent to 1 or 5 modulo 6.
Closed under multiplication.
Term by term, the sequence is one half of its complement within A007417, one third of its complement within A003159, and one sixth of its complement within A036668.
Asymptotic density is 1/2.
The set of all a(n) has maximal lower density (1/2) among sets S such that S, 2S, and 3S are disjoint.
Numbers which do not have 2 or 3 in their Fermi-Dirac factorization. Thus each term is a product of a unique subset of A050376 \ {2,3}.
It follows that the sequence is closed with respect to the commutative binary operation A059897(.,.), forming a subgroup of the positive integers considered as a group under A059897. It is the subgroup generated by A050376 \ {2,3}. A003159, A007417 and A036668 correspond to the nontrivial subgroups of its quotient group. It is the lexicographically earliest ordered transversal of the subgroup {1,2,3,6}, which in ordered form is the lexicographically earliest subgroup of order 4.

Examples

			Numbers are removed by the sieve only due to the presence of a smaller number, so 1 is in the sequence as the smallest positive integer. The sieve removes 2, as it is twice 1, which is in the sequence; so 2 is not in the sequence. The sieve removes 3, as it is three times 1, which is in the sequence, so 3 is not in the sequence. There are no integers m for which 3m = 4 or 6m = 4; 2m = 4 for m = 2, but 2 is not in the sequence; so the sieve does not remove 4, so 4 is in the sequence.
		

Crossrefs

Cf. A050376, A059897, A307150, A339746, A372574 (characteristic function).
Ordered first quadrisection of A052330.
Intersection of any 2 of A003159, A007417 and A036668.
A329575 divided by 3.

Programs

  • Mathematica
    Select[Range[117], EvenQ[IntegerExponent[#, 2]] && EvenQ[IntegerExponent[#, 3]] &]
    f[p_, e_] := p^Mod[e, 2]; core[n_] := Times @@ f @@@ FactorInteger[n]; Select[Range[121], CoprimeQ[core[#], 6] &] (* Amiram Eldar, Feb 06 2021 *)
  • PARI
    isok(m) = core(m) % 6 == 1 || core(m) % 6 == 5;
    
  • Python
    from itertools import count
    from sympy import integer_log
    def A339690(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c = n+x
            for i in range(integer_log(x,9)[0]+1):
                i2 = 9**i
                for j in count(0,2):
                    k = i2<x:
                        break
                    m = x//k
                    c -= (m-1)//6+(m-5)//6+2
            return c
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

{a(n) : n >= 1} = {m : A307150(m) = 6m, m >= 0}.
{a(n) : n >= 1} = {k : k = A052330(4m), m >= 0}.
A329575(n) = a(n) * 3.
{A036668(n) : n >= 0} = {a(n) : n >= 1} U {6 * a(n) : n >= 1}.
{A003159(n) : n >= 1} = {a(n) : n >= 1} U {3 * a(n) : n >= 1}.
{A007417(n) : n >= 1} = {a(n) : n >= 1} U {2 * a(n) : n >= 1}.
a(n) ~ 2n.
Showing 1-10 of 23 results. Next