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

A381837 k/16 is in this list if A053737(k) < A235127(k), i.e. if digitsum(k, 4) < valuation(k, 4).

Original entry on oeis.org

1, 4, 8, 16, 20, 32, 48, 64, 68, 80, 96, 128, 144, 192, 256, 260, 272, 288, 320, 336, 384, 448, 512, 528, 576, 640, 768, 832, 1024, 1028, 1040, 1056, 1088, 1104, 1152, 1216, 1280, 1296, 1344, 1408, 1536, 1600, 1792, 2048, 2064, 2112, 2176, 2304, 2368, 2560, 2816
Offset: 1

Views

Author

Peter Luschny, Mar 08 2025

Keywords

Crossrefs

Cf. A371176 (base 2), A381838 (base 3), A381836 (base 5).

Programs

  • Maple
    aList := upto -> local k; [seq(k/16, k in select(n -> add(convert(n, base, 4)) < padic[ordp](n, 4), [seq(16..upto,16)]))]: aList(46000);
  • Mathematica
    Select[Range[46000],DigitSum[#,4]Stefano Spezia, Mar 08 2025 *)
  • SageMath
    def aList(upto, b): return [n/b^2 for n in srange(b^2, upto, b^2) if sum(n.digits(b)) < valuation(n, b)]
    print(aList(46000, 4))

A381834 k/16 is in this list if k > 4 and A053737(k) = A235127(k), i.e. if digitsum(k, 4) = valuation(k, 4).

Original entry on oeis.org

2, 5, 12, 17, 24, 36, 65, 72, 84, 112, 132, 160, 208, 257, 264, 276, 304, 324, 352, 400, 516, 544, 592, 704, 784, 896, 1025, 1032, 1044, 1072, 1092, 1120, 1168, 1284, 1312, 1360, 1472, 1552, 1664, 1856, 2052, 2080, 2128, 2240, 2320, 2432, 2624, 3088, 3200, 3392
Offset: 1

Views

Author

Peter Luschny, Mar 09 2025

Keywords

Crossrefs

Cf. A381835 (base = 3), A381833 (base = 5).

Programs

  • Mathematica
    Select[Range[16, 60000, 16], DigitSum[#, 4] == IntegerExponent[#, 4] &] / 16

A007814 Exponent of highest power of 2 dividing n, a.k.a. the binary carry sequence, the ruler sequence, or the 2-adic valuation of n.

Original entry on oeis.org

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

Views

Author

John Tromp, Dec 11 1996

Keywords

Comments

This sequence is an exception to my usual rule that when every other term of a sequence is 0 then those 0's should be omitted. In this case we would get A001511. - N. J. A. Sloane
To construct the sequence: start with 0,1, concatenate to get 0,1,0,1. Add + 1 to last term gives 0,1,0,2. Concatenate those 4 terms to get 0,1,0,2,0,1,0,2. Add + 1 to last term etc. - Benoit Cloitre, Mar 06 2003
The sequence is invariant under the following two transformations: increment every element by one (1, 2, 1, 3, 1, 2, 1, 4, ...), put a zero in front and between adjacent elements (0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, ...). The intermediate result is A001511. - Ralf Hinze (ralf(AT)informatik.uni-bonn.de), Aug 26 2003
Fixed point of the morphism 0->01, 1->02, 2->03, 3->04, ..., n->0(n+1), ..., starting from a(1) = 0. - Philippe Deléham, Mar 15 2004
Fixed point of the morphism 0->010, 1->2, 2->3, ..., n->(n+1), .... - Joerg Arndt, Apr 29 2014
a(n) is also the number of times to repeat a step on an even number in the hailstone sequence referenced in the Collatz conjecture. - Alex T. Flood (whiteangelsgrace(AT)gmail.com), Sep 22 2006
Let F(n) be the n-th Fermat number (A000215). Then F(a(r-1)) divides F(n)+2^k for r = k mod 2^n and r != 1. - T. D. Noe, Jul 12 2007
The following relation holds: 2^A007814(n)*(2*A025480(n-1)+1) = A001477(n) = n. (See functions hd, tl and cons in [Paul Tarau 2009].)
a(n) is the number of 0's at the end of n when n is written in base 2.
a(n+1) is the number of 1's at the end of n when n is written in base 2. - M. F. Hasler, Aug 25 2012
Shows which bit to flip when creating the binary reflected Gray code (bits are numbered from the right, offset is 0). That is, A003188(n) XOR A003188(n+1) == 2^A007814(n). - Russ Cox, Dec 04 2010
The sequence is squarefree (in the sense of not containing any subsequence of the form XX) [Allouche and Shallit]. Of course it contains individual terms that are squares (such as 4). - Comment expanded by N. J. A. Sloane, Jan 28 2019
a(n) is the number of zero coefficients in the n-th Stern polynomial, A125184. - T. D. Noe, Mar 01 2011
Lemma: For n < m with r = a(n) = a(m) there exists n < k < m with a(k) > r. Proof: We have n=b2^r and m=c2^r with b < c both odd; choose an even i between them; now a(i2^r) > r and n < i2^r < m. QED. Corollary: Every finite run of consecutive integers has a unique maximum 2-adic valuation. - Jason Kimberley, Sep 09 2011
a(n-2) is the 2-adic valuation of A000166(n) for n >= 2. - Joerg Arndt, Sep 06 2014
a(n) = number of 1's in the partition having Heinz number n. We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product_{j=1..r} p_j-th prime (concept used by Alois P. Heinz in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436. Example: a(24)=3; indeed, the partition having Heinz number 24 = 2*2*2*3 is [1,1,1,2]. - Emeric Deutsch, Jun 04 2015
a(n+1) is the difference between the two largest parts in the integer partition having viabin number n (0 is assumed to be a part). Example: a(20) = 2. Indeed, we have 19 = 10011_2, leading to the Ferrers board of the partition [3,1,1]. For the definition of viabin number see the comment in A290253. - Emeric Deutsch, Aug 24 2017
Apart from being squarefree, as noted above, the sequence has the property that every consecutive subsequence contains at least one number an odd number of times. - Jon Richfield, Dec 20 2018
a(n+1) is the 2-adic valuation of Sum_{e=0..n} u^e = (1 + u + u^2 + ... + u^n), for any u of the form 4k+1 (A016813). - Antti Karttunen, Aug 15 2020
{a(n)} represents the "first black hat" strategy for the game of countably infinitely many hats, with a probability of success of 1/3; cf. the Numberphile link below. - Frederic Ruget, Jun 14 2021
a(n) is the least nonnegative integer k for which there does not exist i+j=n and a(i)=a(j)=k (cf. A322523). - Rémy Sigrist and Jianing Song, Aug 23 2022

Examples

			2^3 divides 24, so a(24)=3.
From _Omar E. Pol_, Jun 12 2009: (Start)
Triangle begins:
  0;
  1,0;
  2,0,1,0;
  3,0,1,0,2,0,1,0;
  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0;
  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0;
  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,...
(End)
		

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 27.
  • K. Atanassov, On the 37th and the 38th Smarandache Problems, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 5 (1999), No. 2, 83-85.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.

Crossrefs

Cf. A011371 (partial sums), A094267 (first differences), A001511 (bisection), A346070 (mod 4).
Bisection of A050605 and |A088705|. Pairwise sums are A050603 and A136480. Difference of A285406 and A281264.
This is Guy Steele's sequence GS(1, 4) (see A135416). Cf. A053398(1,n). Column/row 1 of table A050602.
Cf. A007949 (3-adic), A235127 (4-adic), A112765 (5-adic), A122841 (6-adic), A214411 (7-adic), A244413 (8-adic), A122840 (10-adic).
Cf. A086463 (Dgf at s=2).

Programs

  • Haskell
    a007814 n = if m == 0 then 1 + a007814 n' else 0
                where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Jul 05 2013, May 14 2011, Apr 08 2011
    
  • Haskell
    a007814 n | odd n = 0 | otherwise = 1 + a007814 (n `div` 2)
    --  Walt Rorie-Baety, Mar 22 2013
    
  • Magma
    [Valuation(n, 2): n in [1..120]]; // Bruno Berselli, Aug 05 2013
    
  • Maple
    ord := proc(n) local i,j; if n=0 then return 0; fi; i:=0; j:=n; while j mod 2 <> 1 do i:=i+1; j:=j/2; od: i; end proc: seq(ord(n), n=1..111);
    A007814 := n -> padic[ordp](n,2): seq(A007814(n), n=1..111); # Peter Luschny, Nov 26 2010
  • Mathematica
    Table[IntegerExponent[n, 2], {n, 64}] (* Eric W. Weisstein *)
    IntegerExponent[Range[64], 2] (* Eric W. Weisstein, Feb 01 2024 *)
    p=2; Array[ If[ Mod[ #, p ]==0, Select[ FactorInteger[ # ], Function[ q, q[ [ 1 ] ]==p ], 1 ][ [ 1, 2 ] ], 0 ]&, 96 ]
    DigitCount[BitXor[x, x - 1], 2, 1] - 1; a different version based on the same concept: Floor[Log[2, BitXor[x, x - 1]]] (* Jaume Simon Gispert (jaume(AT)nuem.com), Aug 29 2004 *)
    Nest[Join[ #, ReplacePart[ #, Length[ # ] -> Last[ # ] + 1]] &, {0, 1}, 5] (* N. J. Gunther, May 23 2009 *)
    Nest[ Flatten[# /. a_Integer -> {0, a + 1}] &, {0}, 7] (* Robert G. Wilson v, Jan 17 2011 *)
  • PARI
    A007814(n)=valuation(n,2);
    
  • Python
    import math
    def a(n): return int(math.log(n - (n & n - 1), 2)) # Indranil Ghosh, Apr 18 2017
    
  • Python
    def A007814(n): return (~n & n-1).bit_length() # Chai Wah Wu, Jul 01 2022
    
  • R
    sapply(1:100,function(x) sum(gmp::factorize(x)==2)) # Christian N. K. Anderson, Jun 20 2013
    
  • Scheme
    (define (A007814 n) (let loop ((n n) (e 0)) (if (odd? n) e (loop (/ n 2) (+ 1 e))))) ;; Antti Karttunen, Oct 06 2017

Formula

a(n) = A001511(n) - 1.
a(2*n) = A050603(2*n) = A001511(n).
a(n) = A091090(n-1) + A036987(n-1) - 1.
a(n) = 0 if n is odd, otherwise 1 + a(n/2). - Reinhard Zumkeller, Aug 11 2001
Sum_{k=1..n} a(k) = n - A000120(n). - Benoit Cloitre, Oct 19 2002
G.f.: A(x) = Sum_{k>=1} x^(2^k)/(1-x^(2^k)). - Ralf Stephan, Apr 10 2002
G.f. A(x) satisfies A(x) = A(x^2) + x^2/(1-x^2). A(x) = B(x^2) = B(x) - x/(1-x), where B(x) is the g.f. for A001151. - Franklin T. Adams-Watters, Feb 09 2006
Totally additive with a(p) = 1 if p = 2, 0 otherwise.
Dirichlet g.f.: zeta(s)/(2^s-1). - Ralf Stephan, Jun 17 2007
Define 0 <= k <= 2^n - 1; binary: k = b(0) + 2*b(1) + 4*b(2) + ... + 2^(n-1)*b(n-1); where b(x) are 0 or 1 for 0 <= x <= n - 1; define c(x) = 1 - b(x) for 0 <= x <= n - 1; Then: a(k) = c(0) + c(0)*c(1) + c(0)*c(1)*c(2) + ... + c(0)*c(1)...c(n-1); a(k+1) = b(0) + b(0)*b(1) + b(0)*b(1)*b(2) + ... + b(0)*b(1)...b(n-1). - Arie Werksma (werksma(AT)tiscali.nl), May 10 2008
a(n) = floor(A002487(n - 1) / A002487(n)). - Reikku Kulon, Oct 05 2008
Sum_{k=1..n} (-1)^A000120(n-k)*a(k) = (-1)^(A000120(n)-1)*(A000120(n) - A000035(n)). - Vladimir Shevelev, Mar 17 2009
a(A001147(n) + A057077(n-1)) = a(2*n). - Vladimir Shevelev, Mar 21 2009
For n>=1, a(A004760(n+1)) = a(n). - Vladimir Shevelev, Apr 15 2009
2^(a(n)) = A006519(n). - Philippe Deléham, Apr 22 2009
a(n) = A063787(n) - A000120(n). - Gary W. Adamson, Jun 04 2009
a(C(n,k)) = A000120(k) + A000120(n-k) - A000120(n). - Vladimir Shevelev, Jul 19 2009
a(n!) = n - A000120(n). - Vladimir Shevelev, Jul 20 2009
v_{2}(n) = Sum_{r>=1} (r / 2^(r+1)) Sum_{k=0..2^(r+1)-1} e^(2(k*Pi*i(n+2^r))/(2^(r+1))). - A. Neves, Sep 28 2010, corrected Oct 04 2010
a(n) mod 2 = A096268(n-1). - Robert G. Wilson v, Jan 18 2012
a(A005408(n)) = 1; a(A016825(n)) = 3; A017113(a(n)) = 5; A051062(a(n)) = 7; a(n) = (A037227(n)-1)/2. - Reinhard Zumkeller, Jun 30 2012
a((2*n-1)*2^p) = p, p >= 0 and n >= 1. - Johannes W. Meijer, Feb 04 2013
a(n) = A067255(n,1). - Reinhard Zumkeller, Jun 11 2013
a(n) = log_2(n - (n AND n-1)). - Gary Detlefs, Jun 13 2014
a(n) = 1 + A000120(n-1) - A000120(n), where A000120 is the Hamming weight function. - Stanislav Sykora, Jul 14 2014
A053398(n,k) = a(A003986(n-1,k-1)+1); a(n) = A053398(n,1) = A053398(n,n) = A053398(2*n-1,n) = Min_{k=1..n} A053398(n,k). - Reinhard Zumkeller, Aug 04 2014
a((2*x-1)*2^n) = a((2*y-1)*2^n) for positive n, x and y. - Juri-Stepan Gerasimov, Aug 04 2016
a(n) = A285406(n) - A281264(n). - Ralf Steiner, Apr 18 2017
a(n) = A000005(n)/(A000005(2*n) - A000005(n)) - 1. - conjectured by Velin Yanev, Jun 30 2017, proved by Nicholas Stearns, Sep 11 2017
Equivalently to above formula, a(n) = A183063(n) / A001227(n), i.e., a(n) is the number of even divisors of n divided by number of odd divisors of n. - Franklin T. Adams-Watters, Oct 31 2018
a(n)*(n mod 4) = 2*floor(((n+1) mod 4)/3). - Gary Detlefs, Feb 16 2019
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1. - Amiram Eldar, Jul 11 2020
a(n) = 2*Sum_{j=1..floor(log_2(n))} frac(binomial(n, 2^j)*2^(j-1)/n). - Dario T. de Castro, Jul 08 2022
a(n) = A070939(n) - A070939(A030101(n)). - Andrew T. Porter, Dec 16 2022
a(n) = floor((gcd(n, 2^n)^(n+1) mod (2^(n+1)-1)^2)/(2^(n+1)-1)) (see Lemma 3.4 from Mazzanti's 2002 article). - Lorenzo Sauras Altuzarra, Mar 10 2024
a(n) = 1 - A088705(n). - Chai Wah Wu, Sep 18 2024

Extensions

Formula index adapted to the offset of A025480 by R. J. Mathar, Jul 20 2010
Edited by Ralf Stephan, Feb 08 2014

A369002 Numbers k for which k' / gcd(k,k') is even, where k' stands for the arithmetic derivative of k, A003415.

Original entry on oeis.org

1, 9, 12, 15, 16, 20, 21, 25, 28, 33, 35, 39, 44, 49, 51, 52, 55, 57, 65, 68, 69, 76, 77, 81, 85, 87, 91, 92, 93, 95, 108, 111, 115, 116, 119, 121, 123, 124, 129, 133, 135, 141, 143, 144, 145, 148, 155, 159, 161, 164, 169, 172, 177, 180, 183, 185, 187, 188, 189, 192, 201, 203, 205, 209, 212, 213, 215, 217, 219, 221
Offset: 1

Views

Author

Antti Karttunen, Jan 14 2024

Keywords

Comments

From Antti Karttunen, Feb 09 2024: (Start)
Numbers k for which A276085(k) is a multiple of four.
Even terms in this sequence are all multiples of four.
A multiplicative semigroup; if m and n are in the sequence then so is m*n.
(End)
Appears to be products of an even number of terms from {4} U A065091 (counting repetitions). - Peter Munn, Jul 15 2024

Crossrefs

Cf. A003415, A083345, A087436, A235127, A276085, A369001 (characteristic function), A369003 (complement).
Positions of even terms in A083345.
Subsequence of A368998, which is a subsequence of A235992.
Setwise difference A003159 \ A373142.
Disjoint union of A369005 and A373265.
Disjoint union of A373138 and A373267.
Disjoint union of A369976 and A369977.
Other subsequences: A046337 (odd terms in this sequence), A373259.

Programs

Formula

For all n >= 1, A235127(a(n)) == A087436(a(n)) (mod 2). - Antti Karttunen, Feb 09 2024

A065883 Remove factors of 4 from n (i.e., write n in base 4, drop final zeros, then rewrite in decimal).

Original entry on oeis.org

1, 2, 3, 1, 5, 6, 7, 2, 9, 10, 11, 3, 13, 14, 15, 1, 17, 18, 19, 5, 21, 22, 23, 6, 25, 26, 27, 7, 29, 30, 31, 2, 33, 34, 35, 9, 37, 38, 39, 10, 41, 42, 43, 11, 45, 46, 47, 3, 49, 50, 51, 13, 53, 54, 55, 14, 57, 58, 59, 15, 61, 62, 63, 1, 65, 66, 67, 17, 69, 70, 71, 18, 73, 74, 75
Offset: 1

Views

Author

Henry Bottomley, Nov 26 2001

Keywords

Examples

			a(7)=7, a(14)=14, a(28)=a(4*7)=7, a(56)=a(4*14)=14, a(112)=a(4^2*7)=7.
		

Crossrefs

Cf. A214392, A235127, A350091 (drop final 2's).
Remove other factors: A000265, A038502, A132739, A244414, A242603, A004151.

Programs

  • Maple
    A065883:= n -> n/4^floor(padic:-ordp(n,2)/2):
    map(A065883, [$1..1000]); # Robert Israel, Dec 08 2015
  • Mathematica
    If[Divisible[#,4],#/4^IntegerExponent[#,4],#]&/@Range[80] (* Harvey P. Dale, Aug 31 2013 *)
  • PARI
    a(n)=n/4^valuation(n,4); \\ Joerg Arndt, Dec 09 2015
    
  • Python
    def A065883(n): return n>>((~n&n-1).bit_length()&-2) # Chai Wah Wu, Jul 09 2022

Formula

If n mod 4 = 0 then a(n) = a(n/4), otherwise a(n) = n.
Multiplicative with a(p^e) = 2^(e (mod 2)) if p = 2 and a(p^e) = p^e if p is an odd prime.
a(n) = n/4^A235127(n).
a(n) = A214392(n) if n mod 16 != 0. - Peter Kagey, Sep 02 2015
From Robert Israel, Dec 08 2015: (Start)
G.f.: x/(1-x)^2 - 3 Sum_{j>=1} x^(4^j)/(1-x^(4^j))^2.
G.f. satisfies G(x) = G(x^4) + x/(1-x)^2 - 4 x^4/(1-x^4)^2. (End)
Sum_{k=1..n} a(k) ~ (2/5) * n^2. - Amiram Eldar, Nov 20 2022
Dirichlet g.f.: zeta(s-1)*(4^s-4)/(4^s-1). - Amiram Eldar, Jan 04 2023

A244413 Exponent of highest power of 8 dividing n.

Original entry on oeis.org

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

Views

Author

Wolfdieter Lang, Jun 27 2014

Keywords

Comments

This is the member g = 8 in the g-family of sequences, g integer >= 2, call it phi(g,n), n >= 1. In the Mahler reference, Lemma 2, pp. 6-7, this exponent is called f = -phi if g divides r = n (s = 1 there), and f = 0 if g does not divide r = n (s = 1 there).

References

  • Kurt Mahler, p-adic numbers and their functions, 2nd ed., Cambridge University press, 1981.

Crossrefs

Programs

Formula

n = 8^a(n)*m with a(n) nonnegative integer such that 8 does not divide m, for n >= 1.
O.g.f.: Sum_{k>=1} x^(8^k)/(1-x^(8^k)).
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/7. - Amiram Eldar, Jan 17 2022
a(n) = floor(A007814(n)/3). - Alan Michael Gómez Calderón, Jul 25 2024

A115362 Row sums of ((1,x) + (x,x^2))^(-1)*((1,x)-(x,x^2))^(-1) (using Riordan array notation).

Original entry on oeis.org

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

Views

Author

Paul Barry, Jan 21 2006

Keywords

Comments

Row sums of the matrix product A115358*A115361.
Generalized Ruler Function for k=4. - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
a(n) is 1 + the 4-adic valuation of n+1. - Joerg Arndt, Oct 07 2015

Crossrefs

Cf. A053737, A115358, A115361, quadrisection of A235127.

Programs

  • Mathematica
    a[ n_] := If[ n < 0, 0, 1 + IntegerExponent[n + 1, 4]]; (* Michael Somos, Jul 19 2017 *)
  • PARI
    a(n) = 1 + valuation(n+1,4); \\ Joerg Arndt, Oct 07 2015
    
  • PARI
    {a(n) = if( n<0, 0, n%4==3, 1 + a((n - 3) / 4), 1)}; /* Michael Somos, Jul 13 2017 */
  • Sage
    [(1/3)*(4-sum(n.digits(4))+sum((n-1).digits(4))) for n in [1..96]] # Tom Edgar, Oct 06 2015
    

Formula

G.f.: Sum_{k>=0} x^(4^k)/(1-x^(4^k)). - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
Dirichlet g.f. (conjectured): zeta(s)/(1-2^(-2s)). - Ralf Stephan, Mar 27 2015
a(n) = (1/3)*(4 + A053737(n) - A053737(n+1)). - Tom Edgar, Oct 06 2015
a(4*n) = a(4*n+1) = a(4*n+2) = 1, a(4*n+3) = 1+a(n), if n >= 0. - Michael Somos, Jul 13 2017
a(n) = 1 + A235127(1+n). - Antti Karttunen, Nov 18 2017, after Joerg Arndt's Oct 07 2015 comment.

A090616 Exponent of highest power of 4 dividing n!.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 11, 11, 11, 11, 12, 12, 13, 13, 15, 15, 16, 16, 17, 17, 17, 17, 19, 19, 19, 19, 20, 20, 21, 21, 23, 23, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 31, 31, 32, 32, 33, 33, 33, 33, 35, 35, 35, 35, 36
Offset: 0

Views

Author

Henry Bottomley, Dec 06 2003

Keywords

Examples

			a(6)=2 since 6! = 720 = 4^2 * 45.
		

Crossrefs

Programs

  • Mathematica
    IntegerExponent[Range[0, 100]!, 4] (* Vincenzo Librandi, Mar 10 2013 *)
  • PARI
    a(n) = valuation( n!, 4 ); /* Joerg Arndt, Mar 10 2013 */
    (Python 3.10+)
    def A090616(n): return (n-n.bit_count())>>1 # Chai Wah Wu, Jul 09 2022

Formula

a(n) = A090622(n, 4) = floor(A011371(n)/2) = floor((floor(n/2) + floor(n/4) + floor(n/8) + floor(n/16) + ...)/2).
a(n) = A235127(n!). - R. J. Mathar, Jul 08 2021

A249344 A(n,k) = exponent of the largest power of n-th prime which divides k, square array read by antidiagonals.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 28 2014

Keywords

Comments

Square array A(n,k), where n = row, k = column, read by antidiagonals: A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ... (transpose of array A060175).
A(n,k) is the (p_n)-adic valuation of k, where p_n is the n-th prime, A000040(n).
Each row is effectively a ruler function, s, with s(1) = 0. - Peter Munn, Apr 30 2022

Examples

			The top-left corner of the array:
  0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, ...
  0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, ...
  0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ...
  0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, ...
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, ...
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, ...
  ...
A(1,8) = 3, because 2^3 is the largest power of 2 (= p_1 = A000040(1)) that divides 8.
a(2,9) = 2, because 3^2 is the largest power of 3 (= p_2) that divides 9.
a(3,15) = 1, because 5^1 is the largest power of 5 (= p_3) that divides 15.
		

Crossrefs

Transpose: A060175.
Row 1: A007814.
Row 2: A007949.
Row 3: A112765.
Row 4: A214411.
Completely additive sequences where more than one prime is mapped to 1, all other primes to 0: A065339, A083025, A087436, A169611.
Ruler functions, s, with s(1) = 0 that are not rows here: A122840, A122841, A235127, A244413.

Programs

  • Mathematica
    A[n_, k_] := IntegerExponent[k, Prime[n]]; Table[A[k, n - k + 1], {n, 1, 15}, {k, 1, n}] // Flatten (* Amiram Eldar, Oct 01 2023 *)
  • PARI
    a(n, k) = valuation(k, prime(n)); \\ Michel Marcus, Jun 24 2017
  • Python
    from sympy import prime
    def a(n, k):
        p=prime(n)
        i=z=0
        while p**i<=k:
            if k%(p**i)==0: z=i
            i+=1
        return z
    for n in range(1, 10): print([a(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, Jun 24 2017
    
  • Scheme
    (define (A249344 n) (A249344bi (A002260 n) (A004736 n)))
    (define (A249344bi row col) (let ((p (A000040 row))) (let loop ((n col) (i 0)) (cond ((not (zero? (modulo n p))) i) (else (loop (/ n p) (+ i 1)))))))
    

Formula

Row n, as a sequence, is completely additive with A(n, prime(n)) = 1, A(n, prime(m)) = 0 for m <> n. - Peter Munn, Apr 30 2022
Sum_{k=1..m} A(n,k) ~ (1/(prime(n)-1)) * m. - Amiram Eldar, Oct 01 2023

A054893 a(n) = Sum_{j > 0} floor(n/4^j).

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24
Offset: 0

Views

Author

Henry Bottomley, May 23 2000

Keywords

Comments

Different from highest power of 4 dividing n! (see A090616).

Examples

			  a(10^0) = 0.
  a(10^1) = 2.
  a(10^2) = 32.
  a(10^3) = 330.
  a(10^4) = 3331.
  a(10^5) = 33330.
  a(10^6) = 333330.
  a(10^7) = 3333329.
  a(10^8) = 33333328.
  a(10^9) = 333333326.
		

Crossrefs

Cf. A053737, A235127 (first differences).

Programs

  • Magma
    function A054893(n)
      if n eq 0 then return n;
      else return A054893(Floor(n/4)) + Floor(n/4);
      end if; return A054893;
    end function;
    [A054893(n): n in [0..103]]; // G. C. Greubel, Feb 09 2023
    
  • Mathematica
    Table[t=0; p=4; While[s=Floor[n/p]; t=t+s; s>0, p *= 4]; t, {n,0,100}]
    Table[Total[Floor/@(n/NestList[4#&,4,6])],{n,0,80}] (* Harvey P. Dale, Jun 12 2022 *)
  • PARI
    a(n) = (n - sumdigits(n,4))/3; \\ Kevin Ryde, Jan 08 2024
  • SageMath
    def A054893(n):
        if (n==0): return 0
        else: return A054893(n//4) + (n//4)
    [A054893(n) for n in range(104)] # G. C. Greubel, Feb 09 2023
    

Formula

a(n) = floor(n/4) + floor(n/16) + floor(n/64) + floor(n/256) + ...
a(n) = (n - A053737(n))/3.
From Hieronymus Fischer, Sep 15 2007: (Start)
a(n) = a(floor(n/4)) + floor(n/4).
a(4*n) = a(n) + n.
a(n*4^m) = a(n) + n*(4^m-1)/3.
a(k*4^m) = k*(4^m-1)/3, for 0 <= k < 4, m >= 0.
Asymptotic behavior:
a(n) = n/3 + O(log(n)),
a(n+1) - a(n) = O(log(n)); this follows from the inequalities below.
a(n) <= (n-1)/3; equality holds true for powers of 4.
a(n) >= (n-3)/3 - floor(log_4(n)); equality holds true for n = 4^m - 1, m>0. lim inf (n/3 - a(n)) = 1/3, for n-->oo.
lim sup (n/3 - log_4(n) - a(n)) = 0, for n-->oo.
lim sup (a(n+1) - a(n) - log_4(n)) = 0, for n-->oo.
G.f.: (1/(1-x))*Sum_{k > 0} x^(4^k)/(1-x^(4^k)). (End)
Partial sums of A235127. - R. J. Mathar, Jul 08 2021

Extensions

Edited by Hieronymus Fischer, Sep 15 2007
Examples added by Hieronymus Fischer, Jun 06 2012
Showing 1-10 of 22 results. Next