A001511 The ruler function: exponent of the highest power of 2 dividing 2n. Equivalently, the 2-adic valuation of 2n.
1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1
Offset: 1
A051064 3^a(n) exactly divides 3n. Or, 3-adic valuation of 3n.
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
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)
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.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
- A. M. Hinz, S. Klavžar, U. Milutinović, and C. Petr, The Tower of Hanoi - Myths and Maths, Birkhäuser 2013. See page 243. Book's website
- Tamas Lengyel, Divisiblity Properties by Multisection, Fib. Quart. 41 (1) (2003) 72.
- Simon Plouffe, On the values of the functions zeta and gamma, arXiv preprint arXiv:1310.7195 [math.NT], 2013.
- Joseph Rosenbaum, Elementary Problem E319, American Mathematical Monthly, volume 45, number 10, December 1938, pages 694-696. (The A indices in P at equations 1' and 2' for p=3.)
- Index entries for sequences that are fixed points of mappings.
Crossrefs
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
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) = 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
A235127 Greatest k such that 4^k divides n.
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1
Offset: 1
Examples
Since 4^2 divides 32 and 4^3 does not, we have a(32) = 2. Likewise, since no positive power of 4 divides 9, a(9) = 0.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Programs
-
Mathematica
IntegerExponent[Range@ 105, 4] (* Michael De Vlieger, Nov 18 2017 *)
-
PARI
A235127(n) = valuation(n,4); \\ Antti Karttunen, Nov 18 2017
-
Python
def A235127(n): return (~n&n-1).bit_length()>>1 # Chai Wah Wu, Jul 08 2022
-
Sage
n=100 #change n for more terms [valuation(i,4) for i in [1..n]]
Formula
a(n) = valuation(n,4).
G.f.: Sum_{k>=1} x^(4^k)/(1 - x^(4^k)). - Ilya Gutkovskiy, Jan 28 2017
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/3. - Amiram Eldar, Jan 17 2022
Extensions
More terms from Antti Karttunen, Nov 18 2017
A055457 5^a(n) exactly divides 5n. Or, 5-adic valuation of 5n.
1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2
Offset: 1
Comments
More generally, consider the sequence defined by p^a(n) exactly divides p*n. For p = 3 we have A051064 and for p = 2 we have A001511.
The number of powers of 5 that divide n. - Amiram Eldar, Mar 29 2025
Examples
a(5) = 2 since 5^2 exactly divides 5 times 5; a(25) = 3 since 5^3 exactly divides 5 times 25; a(125) = 4 since 5^4 exactly divides 5 times 125.
Links
- T. D. Noe, Table of n, a(n) for n=1..1000
- Joseph Rosenbaum, Elementary Problem E319, American Mathematical Monthly, volume 45, number 10, December 1938, pages 694-696. (The A indices in P at equations 1' and 2' for p=5.)
Crossrefs
Programs
-
Maple
seq(padic:-ordp(5*n,5), n=1..1000); # Robert Israel, Dec 07 2015
-
Mathematica
max = 1000; s = (1/x)*Sum[x^(5^k)/(1-x^5^k), {k, 0, Log[5, max] // Ceiling }] + O[x]^max; CoefficientList[s, x] (* Jean-François Alcover, Dec 04 2015 *) Table[IntegerExponent[n, 5] + 1, {n, 1, 100}] (* Amiram Eldar, Sep 21 2020 *)
-
PARI
a(n)=-sumdiv(n,d,moebius(5*d)*numdiv(n/d)) \\ Benoit Cloitre, Jun 21 2007
-
PARI
a(n)=valuation(5*n,5) \\ Anders Hellström, Dec 04 2015
-
Python
def A055457(n): c = 1 while not (a:=divmod(n,5))[1]: c += 1 n = a[0] return c # Chai Wah Wu, Feb 28 2025
Formula
G.f.: Sum_{k>=0} x^(5^k)/(1-x^5^k). - Ralf Stephan, Apr 12 2002
Multiplicative with a(p^e) = e+1 if p = 5, 1 otherwise.
a(n) = -Sum_{d|n} mu(5d)*tau(n/d). - Benoit Cloitre, Jun 21 2007
Dirichlet g.f.: zeta(s)/(1-1/5^s). - R. J. Mathar, Feb 09 2011
a(n) = A112765(5n). - R. J. Mathar, Jul 17 2012
a(5n) = 1 + a(n). a(5n+k) = 1 for k = 1..4. - Robert Israel, Dec 07 2015
G.f. satisfies A(x^5) = A(x) - x/(1-x). - Robert Israel, Dec 08 2015
a(n) = A112765(n) + 1. - Amiram Eldar, Sep 21 2020
Sum_{k=1..n} a(k) ~ 5*n/4. - Vaclav Kotesovec, Sep 21 2020
G.f.: Sum_{i>=1, j>=0} x^(i*5^j). - Seiichi Manyama, Mar 23 2025
A174065 Convolved with its aerated variant = A000041.
1, 1, 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 31, 38, 48, 60, 73, 89, 109, 133, 161, 193, 232, 279, 333, 395, 470, 558, 658, 775, 912, 1071, 1254, 1464, 1708, 1991, 2313, 2681, 3107, 3595, 4149, 4782, 5506, 6331, 7268, 8330, 9538, 10912, 12462, 14213, 16199
Offset: 0
Keywords
Comments
Examples
Heading at top, with triangle A174066 underneath (the generator for A174065): 1, 1, 1, 2, 3, 4,.... = heading 1;................... = 1 1;................... = 1 1, 1;................ = 2 2, 1;................ = 3 3, 1, 1;............. = 5 4, 2, 1;............. = 7 5, 3, 1, 2;.......... = 11 7, 4, 2, 2;.......... = 15 9, 5, 3, 2, 3;....... = 22 ... ... where terms in the left column are the result of the two rules: multiply heading * left column, and row sums = partition numbers. Thus leftmost term in column 8 must be 7 = 15 - (4 + 2 + 2). Then the 7 is placed in its spot in the left column and as the next heading term.
Links
- Vaclav Kotesovec, Table of n, a(n) for n = 0..10000 (terms 0..5000 from Alois P. Heinz)
Programs
-
Maple
p:= combinat[numbpart]: a:= proc(n) option remember; `if`(n=0, 1, p(n)-add(a(j)* `if`(irem(n-j, 2, 'r')=1, 0, a(r)), j=0..n-1)) end: seq(a(n), n=0..61); # Alois P. Heinz, Jul 27 2019
-
Mathematica
nmax = 60; CoefficientList[Series[Product[QPochhammer[-1, x^(4^j)]/2, {j, 0, Log[nmax]/Log[4]}], {x, 0, nmax}], x] (* Vaclav Kotesovec, Sep 24 2019 *)
Formula
Aerate and convolve sequences are generated by triangles (in this case A174066) in which ongoing terms are placed in the left column and at the top as a heading. Columns >1 are shifted down k times (k=2) in this case corresponding to (k-1) interpolated zeros. Next term in left column = n-th term in the "target sequence" S(n) (in this case A000041) minus (sum of terms in n-th row for columns >1). Place the latter term in the heading filling in missing terms.
G.f.: Product_{i>=1, j>=0} (1 + x^(i*4^j)). - Ilya Gutkovskiy, Sep 23 2019
a(n) ~ exp(2*Pi*sqrt(n)/3) / (2^(11/8) * 3^(3/4) * n^(7/8)). - Vaclav Kotesovec, Sep 24 2019
From Seiichi Manyama, May 31 2024: (Start)
G.f.: Product_{k>=1} (1 + x^k)^(valuation(k,4) + 1).
Let A(x) be the g.f. of this sequence, and B(x) be the g.f. of A000009, then B(x) = A(x)/A(x^4). (End)
Extensions
More terms from R. J. Mathar, Mar 18 2010
Offset corrected by Alois P. Heinz, Jul 27 2019
A373216 Expansion of Sum_{k>=0} x^(6^k) / (1 - x^(6^k)).
1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3
Offset: 1
Keywords
Links
- Seiichi Manyama, Table of n, a(n) for n = 1..10000
Programs
-
PARI
a(n) = valuation(n, 6)+1;
Formula
G.f. A(x) satisfies A(x) = x/(1 - x) + A(x^6).
a(6*n+1) = a(6*n+2) = ... = (6*n+5) = 1 and a(6*n+6) = 1 + a(n+1) for n >= 0.
a(n) = A122841(n) + 1.
G.f.: Sum_{i>=1, j>=0} x^(i*6^j). - Seiichi Manyama, Mar 23 2025
a(n) = A122841(6*n). - R. J. Mathar, Jun 28 2025
A373217 Expansion of Sum_{k>=0} x^(7^k) / (1 - x^(7^k)).
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2
Offset: 1
Comments
The number of powers of 7 that divide n. - Amiram Eldar, Mar 29 2025
Links
- Seiichi Manyama, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := 1 + IntegerExponent[n, 7]; Array[a, 100] (* Amiram Eldar, May 29 2024 *)
-
PARI
a(n) = valuation(n, 7)+1;
Formula
G.f. A(x) satisfies A(x) = x/(1 - x) + A(x^7).
a(7*n+1) = a(7*n+2) = ... = (7*n+6) = 1 and a(7*n+7) = 1 + a(n+1) for n >= 0.
Multiplicative with a(p^e) = e+1 if p = 7, 1 otherwise.
a(n) = -Sum_{d|n} mu(7*d) * tau(n/d).
a(n) = A214411(n) + 1.
From Amiram Eldar, May 29 2024: (Start)
Dirichlet g.f.: (7^s/(7^s-1)) * zeta(s).
Sum_{k=1..n} a(k) ~ (7/6) * n. (End)
G.f.: Sum_{i>=1, j>=0} x^(i*7^j). - Seiichi Manyama, Mar 23 2025
a(n) = A214411(7*n). - R. J. Mathar, Jun 28 2025
A373280 Expansion of Sum_{k>=0} x^(4^k) / (1 - 4*x^(4^k)).
1, 4, 16, 65, 256, 1024, 4096, 16388, 65536, 262144, 1048576, 4194320, 16777216, 67108864, 268435456, 1073741889, 4294967296, 17179869184, 68719476736, 274877907200, 1099511627776, 4398046511104, 17592186044416, 70368744178688, 281474976710656, 1125899906842624
Offset: 1
Keywords
Links
- Seiichi Manyama, Table of n, a(n) for n = 1..1000
Formula
G.f. A(x) satisfies A(x) = x/(1 - 4*x) + A(x^4).
If n == 0 (mod 4), a(n) = 4^n + a(n/4) otherwise a(n) = 4^n.
A373295 Expansion of 1/Product_{k>=1} (1 - x^k)^(valuation(k,4) + 1).
1, 1, 2, 3, 6, 8, 13, 18, 29, 39, 57, 77, 112, 148, 205, 271, 373, 485, 649, 841, 1116, 1431, 1865, 2379, 3080, 3896, 4979, 6268, 7961, 9953, 12524, 15585, 19505, 24135, 29984, 36943, 45678, 56007, 68841, 84080, 102912, 125164, 152449, 184756, 224184, 270691, 327094, 393675
Offset: 0
Keywords
Programs
-
PARI
my(N=50, x='x+O('x^N)); Vec(1/prod(k=1, N, (1-x^k)^(valuation(k, 4)+1)))
Formula
G.f.: A(x) = 1/Product_{i>=1, j>=0} (1 - x^(i * 4^j)).
Let A(x) be the g.f. of this sequence, and P(x) be the g.f. of A000041, then P(x) = A(x)/A(x^4).
A382372 Expansion of 1/( 1 - Sum_{k>=0} x^(4^k) / (1 - x^(4^k)) ).
1, 1, 2, 4, 9, 18, 37, 76, 158, 325, 670, 1381, 2850, 5876, 12117, 24986, 51530, 106262, 219131, 451885, 931876, 1921695, 3962884, 8172182, 16852538, 34752996, 71667001, 147790386, 304770689, 628492615, 1296066140, 2672724207, 5511643710, 11366012289
Offset: 0
Keywords
Formula
a(0) = 1; a(n) = Sum_{k=1..n} A115362(k-1) * a(n-k).
G.f.: 1/(1 - Sum_{i>=1, j>=0} x^(i*4^j)).
G.f. A(x) satisfies A(x) = 1/( 1/A(x^4) - x/(1-x) ).
Comments
Examples
References
Links
Crossrefs
Programs
Haskell
Haskell
MATLAB
Magma
Maple
Mathematica
PARI
PARI
PARI
PARI
Python
Python
Python
Sage
Scheme
Formula
Extensions