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

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

A007949 Greatest k such that 3^k divides n. Or, 3-adic valuation of n.

Original entry on oeis.org

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

Views

Author

R. Muller

Keywords

Comments

Obeys the general recurrences for p-adic valuation discussed in A214411. - Redjan Shabani, Jul 17 2012
Lexicographically earliest cubefree sequence, which also (conjecturally) appears in the construction of the lexicographically earliest cubefree {0,1}-sequence A282317, cf. Example section of A286940. - M. F. Hasler, May 21 2017
The sequence is invariant under the "lower trim" operator: remove all zeros, and subtract one from each remaining term. - Franklin T. Adams-Watters, May 25 2017

References

  • F. Q. Gouvea, p-Adic Numbers, Springer-Verlag, 1993; see p. 23.

Crossrefs

Partial sums give A054861.
One less than A051064.

Programs

  • Haskell
    a007949 n = if m > 0 then 0 else 1 + a007949 n'
                where (n', m) = divMod n 3
    -- Reinhard Zumkeller, Jun 23 2013, May 14 2011
    
  • MATLAB
    % Input:
    %  n: an integer
    % Output:
    %  m: max power of 3 such that 3^m divides n
    %  M: 1-by-K matrix where M(i) is the max power of 3 such that 3^M(i) divides n
    function [m,M] = Omega3(n)
      M = NaN*zeros(1,n);
      M(1)=0; M(2)=0; M(3)=0;
        for k=4:n
          if M(k-3)~=0
            M(k)=M(k-k/3)+1;
          else
            M(k)=0;
          end
        end
        m=M(end);
    end
    % Redjan Shabani, Jul 17 2012
    
  • Magma
    [Valuation(n, 3): n in [1..110]]; // Bruno Berselli, Aug 05 2013
    
  • Maple
    A007949 := proc(n) option remember; if n mod 3 > 0 then 0 else procname(n/3)+1; fi; end;
    # alternative by R. J. Mathar, Mar 29 2017
    A007949 := proc(n)
        padic[ordp](n,3) ;
    end proc:
  • Mathematica
    p=3; Array[ If[ Mod[ #, p ]==0, Select[ FactorInteger[ # ], Function[ q, q[ [ 1 ] ]==p ], 1 ][ [ 1, 2 ] ], 0 ]&, 81 ]
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 0, 1}, 1 -> {0, 0, 2}, 2 -> {0, 0, 3}, 3 -> {0, 0, 4}}) ]}], {0}, 5] (* Robert G. Wilson v, Mar 03 2005 *)
    IntegerExponent[Range[200], 3] (* Zak Seidov, Apr 15 2010 *)
    Table[If[Mod[n, 3] > 0, 0, 1 + b[n/3]], {n, 200}] (* Zak Seidov, Apr 15 2010 *)
  • PARI
    a(n)=valuation(n,3)
    
  • Python
    def a(n):
        k = 0
        while n > 0 and n%3 == 0: n //= 3; k += 1
        return k
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Aug 06 2021
  • Sage
    [valuation(n, 3) for n in (1..106)]  # Peter Luschny, Nov 16 2012
    
  • Scheme
    (define (A007949 n) (let loop ((n n) (k 0)) (cond ((not (zero? (modulo n 3))) k) (else (loop (/ n 3) (+ 1 k)))))) ;; Antti Karttunen, Oct 06 2017
    

Formula

a(n) = 0 if n != 0 (mod 3), otherwise a(n) = 1 + a(n/3). - Reinhard Zumkeller, Aug 12 2001, edited by M. F. Hasler, Aug 11 2015
From Ralf Stephan, Apr 12 2002: (Start)
a(n) = A051064(n) - 1.
G.f.: Sum_{k>=1} x^3^k/(1 - x^3^k). (End)
Fixed point of the morphism: 0 -> 001; 1 -> 002; 2 -> 003; 3 -> 004; 4 -> 005; etc.; starting from a(1) = 0. - Philippe Deléham, Mar 29 2004
a(n) mod 2 = 1 - A014578(n). - Reinhard Zumkeller, Oct 04 2008
Totally additive with a(p) = 1 if p = 3, 0 otherwise.
v_{m}(n) = Sum_{r>=1} (r/m^(r+1)) Sum_{j=1..m-1} Sum_{k=0..m^(r+1)-1} exp((2*k*Pi*i*(n+(m-j)*m^r)) / m^(r+1)). This formula is for the general case; for this specific one, set m=3. - A. Neves, Oct 04 2010
a(3n) = A051064(n), a(2n) = a(n), a(2n-1) = A253786(n). - Cyril Damamme, Aug 04 2015
a(3n) = a(n) + 1, a(pn) = a(n) for any other prime p != 3. - M. F. Hasler, Aug 11 2015
3^a(n) = A038500(n). - Antti Karttunen, Oct 09 2017
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Jul 11 2020
a(n) = tau(n)/(tau(3*n) - tau(n)) - 1, where tau(n) = A000005(n). - Peter Bala, Jan 06 2021
a(n) = 3*Sum_{j=1..floor(log_3(n))} frac(binomial(n,3^j)*3^(j-1)/n). - Dario T. de Castro, Jul 10 2022
a(n) = A080342(gcd(n, 3^A080342(n))). - Alan Michael Gómez Calderón, Jul 28 2024

A345531 Smallest prime power greater than the n-th prime.

Original entry on oeis.org

3, 4, 7, 8, 13, 16, 19, 23, 25, 31, 32, 41, 43, 47, 49, 59, 61, 64, 71, 73, 79, 81, 89, 97, 101, 103, 107, 109, 113, 121, 128, 137, 139, 149, 151, 157, 163, 167, 169, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 243, 256, 263, 269, 271, 277
Offset: 1

Views

Author

Dario T. de Castro, Jun 20 2021

Keywords

Comments

Take the family of correlated prime-indexed conjectures appearing in A343249 - A343253, in which an alternative formula for the p-adic order of positive integers is proposed. There, the general p-indexed conjecture says that v_p(n), the p-adic order of n, is given by the formula: v_p(n) = log_p(n / L_p(k0, n)), where L_p(k0, n) is the lowest common denominator of the elements of the set S_p(k0, n) = {(1/n)*binomial(n, k), with 0 < k <= k0 such that k is not divisible by p}. Evidence suggests that the primality of p is a necessary condition in this general conjecture. So, if a composite number q is used instead of a prime p in the proposed formula for the p-adic (now, q-adic) order of n, the first counterexample (failure) is expected to occur for n = q * a(i), where i is the index of the smallest prime that divides q.
The prime-power a(n) is at most the next prime, so this sequence is strictly increasing. See also A366833. - Gus Wiseman, Nov 06 2024

Examples

			a(4) = 8 because the fourth prime number is 7, and the least power of a prime which is greater than 7 is 2^3 = 8.
		

Crossrefs

Starting with n instead of prime(n): A000015, A031218, A377468, A377780, A377782.
Opposite (greatest prime-power less than): A065514, A377289, A377781.
For squarefree instead of prime-power: A112926, opposite A112925.
The difference from prime(n) is A377281.
The prime terms have indices A377286(n) - 1.
First differences are A377703.
A version for perfect-powers is A378249.
A000961 and A246655 list the prime-powers, differences A057820.
A024619 and A361102 list the non-prime-powers, differences A375735.

Programs

  • Maple
    f:= proc(n) local p,x;
      p:= ithprime(n);
      for x from p+1 do
        if nops(numtheory:-factorset(x)) = 1 then return x fi
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, Aug 25 2024
  • Mathematica
    a[i_]:= Module[{j, k, N = 0, tab={}}, tab = Sort[Drop[DeleteDuplicates[Flatten[Table[ If[Prime[j]^k > Prime[i], Prime[j]^k], {j, 1, i+1}, {k, 1, Floor[Log[Prime[j], Prime[i+1]]]}]]], 1]]; N = Take[tab, 1][[1]]; N];
    tabseq = Table[a[i],{i, 1, 100}];
    (* second program *)
    Table[NestWhile[#+1&,Prime[n]+1, Not@*PrimePowerQ],{n,100}] (* Gus Wiseman, Nov 06 2024 *)
  • PARI
    A000015(n) = for(k=n,oo,if((1==k)||isprimepower(k),return(k)));
    A345531(n) = A000015(1+prime(n)); \\ Antti Karttunen, Jul 19 2021
    
  • Python
    from itertools import count
    from sympy import prime, factorint
    def A345531(n): return next(filter(lambda m:len(factorint(m))<=1, count(prime(n)+1))) # Chai Wah Wu, Oct 25 2024

Formula

a(n) = A000015(1+A000040(n)). - Antti Karttunen, Jul 19 2021
a(n) = A000015(A008864(n)). - Omar E. Pol, Oct 27 2021

A054708 Number of powers of 7 modulo n.

Original entry on oeis.org

1, 1, 1, 2, 4, 1, 2, 2, 3, 4, 10, 2, 12, 2, 4, 2, 16, 3, 3, 4, 2, 10, 22, 2, 4, 12, 9, 3, 7, 4, 15, 4, 10, 16, 5, 6, 9, 3, 12, 4, 40, 2, 6, 10, 12, 22, 23, 2, 3, 4, 16, 12, 26, 9, 20, 3, 3, 7, 29, 4, 60, 15, 4, 8, 12, 10, 66, 16, 22, 5, 70, 6, 24, 9, 4, 6, 11, 12, 78, 4, 27, 40, 41, 3, 16, 6
Offset: 1

Views

Author

Henry Bottomley, Apr 20 2000

Keywords

Crossrefs

Cf. A054703 (base 2), A054704 (3), A054705 (4), A054706 (5), A054707 (6), A054709 (8), A054717 (9), A054710 (10), A351524 (11), A054712 (12), A054713 (13), A054714 (14), A054715 (15), A054716 (16).

Programs

  • Mathematica
    a[n_] := Module[{e = IntegerExponent[n, 7]}, e + MultiplicativeOrder[7, n/7^e]]; Array[a, 100] (* Amiram Eldar, Aug 25 2024 *)

Formula

a(n) = A007738(n) + A214411(n). - Amiram Eldar, Aug 25 2024

A054896 a(n) = Sum_{k>0} floor(n/7^k).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13
Offset: 0

Views

Author

Henry Bottomley, May 23 2000

Keywords

Comments

Exponent of the highest power of 7 dividing n!.

Examples

			  a(10^0) = 0.
  a(10^1) = 1.
  a(10^3) = 16.
  a(10^3) = 164.
  a(10^4) = 1665.
  a(10^5) = 16662.
  a(10^6) = 166664.
  a(10^7) = 1666661.
  a(10^8) = 16666662.
  a(10^9) = 166666661
		

Crossrefs

Cf. A011371 and A054861 for analogs involving powers of 2 and 3.

Programs

Formula

a(n) = floor(n/7) + floor(n/49) + floor(n/343) + floor(n/2401) + ...
a(n) = (n - A053828(n))/6.
From Hieronymus Fischer, Aug 14 2007: (Start)
a(n) = a(floor(n/7)) + floor(n/7).
a(7*n) = n + a(n).
a(n*7^m) = a(n) + n*(7^m-1)/6.
a(k*7^m) = k*(7^m-1)/6, for 0 <= k < 7, m >= 0.
Asymptotic behavior:
a(n) = n/6 + O(log(n)).
a(n+1) - a(n) = O(log(n)); this follows from the inequalities below.
a(n) <= (n-1)/6; equality holds for powers of 7.
a(n) >= (n-6)/6 - floor(log_7(n)); equality holds for n=7^m-1, m>0. -
lim inf (n/6 - a(n)) = 1/6, for n-->oo.
lim sup (n/6 - log_7(n) - a(n)) = 0, for n-->oo.
lim sup (a(n+1) - a(n) - log_7(n)) = 0, for n-->oo.
G.f.: (1/(1-x))*Sum_{k > 0} x^(7^k)/(1-x^(7^k)). (End)
Partial sums of A214411. - R. J. Mathar, Jul 08 2021
a(n) = A214411(A000142(n)). - Michel Marcus, Oct 07 2024

Extensions

Examples added by Hieronymus Fischer, Jun 06 2012

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

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

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Henry Bottomley, Mar 14 2001

Keywords

Examples

			a(12,1) = 2 since 4 = 2^2 = p_1^2 divides 12 but 8 = 2^3 does not.
a(12,2) = 1 since 3 = p_2 divides 12 but 9 = 3^2 does not.
See also examples in A249344, which is transpose of this array.
The top-left corner of the array:
n\k | 1  2  3  4  5  6  7  8
----+------------------------
1   | 0, 0, 0, 0, 0, 0, 0, 0,
2   | 1, 0, 0, 0, 0, 0, 0, 0,
3   | 0, 1, 0, 0, 0, 0, 0, 0,
4   | 2, 0, 0, 0, 0, 0, 0, 0,
5   | 0, 0, 1, 0, 0, 0, 0, 0,
6   | 1, 1, 0, 0, 0, 0, 0, 0,
7   | 0, 0, 0, 1, 0, 0, 0, 0,
8   | 3, 0, 0, 0, 0, 0, 0, 0,
9   | 0, 2, 0, 0, 0, 0, 0, 0,
10  | 1, 0, 1, 0, 0, 0, 0, 0,
11  | 0, 0, 0, 0, 1, 0, 0, 0,
12  | 2, 1, 0, 0, 0, 0, 0, 0,
...
		

Crossrefs

Transpose: A249344.
Column 1: A007814.
Column 2: A007949.
Column 3: A112765.
Column 4: A214411.
Row sums: A001222.

Programs

  • Mathematica
    T[n_, k_] := IntegerExponent[n, Prime[k]];
    Table[T[n-k+1, k], {n, 1, 15}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Nov 18 2019 *)
  • PARI
    a(n, k) = valuation(n, prime(k)); \\ 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(n - k + 1, k) for k in range(1, n + 1)]) # Indranil Ghosh, Jun 24 2017
    
  • Scheme
    (define (A060175 n) (A249344bi (A004736 n) (A002260 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)))))))
    ;; Antti Karttunen, Oct 28 2014
    

Formula

A(n, k) = log(A060176(n, k))/log(A000040(k)) = k-th digit from right of A054841(n).

Extensions

Erroneous example corrected and more terms computed by Antti Karttunen, Oct 28 2014
Name clarified by Antti Karttunen, Jan 16 2025

A242603 Largest divisor of n not divisible by 7. Remove factors 7 from n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 1, 8, 9, 10, 11, 12, 13, 2, 15, 16, 17, 18, 19, 20, 3, 22, 23, 24, 25, 26, 27, 4, 29, 30, 31, 32, 33, 34, 5, 36, 37, 38, 39, 40, 41, 6, 43, 44, 45, 46, 47, 48, 1, 50, 51, 52, 53, 54, 55, 8, 57, 58, 59, 60, 61, 62, 9, 64, 65, 66, 67, 68, 69, 10, 71, 72, 73, 74, 75, 76, 11
Offset: 1

Views

Author

Wolfdieter Lang, Jun 18 2014

Keywords

Comments

This is member p = 7 in the p-family of sequences (p a prime).
See A000265, A038502 and A132739 for primes 2, 3 and 5, also for formulas, programs and references.
As well as being multiplicative, a(n) is a strong divisibility sequence, that is, gcd(a(n),a(m)) = a(gcd(n,m)) for n, m >= 1. In particular, a(n) is a divisibility sequence: if n divides m then a(n) divides a(m). - Peter Bala, Feb 21 2019

Examples

			From _Indranil Ghosh_, Jan 31 2017: (Start)
For n = 12, the divisors of 12 are 1,2,3,4,6 and 12. The largest divisor not divisible by 7 is 12. So, a(12) = 12.
For n = 14, the divisors of 14 are 1,2,7 and 14. The largest divisor not divisible by 7 is 2. So, a(14) = 2. (End)
From _Peter Bala_, Feb 21 2019: (Start)
Sum_{n >= 1} n*a(n)*x^n = G(x) - (6*7)*G(x^7) - (6*49)*G(x^49) - (6*343)*G(x^343) - ..., where G(x) = x*(1 + x)/(1 - x)^3.
Sum_{n >= 1} (1/n)*a(n)*x^n = H(x) - (6/7)*H(x^7) - (6/49)*H(x^49) - (6/343)*H(x^343) - ..., where H(x) = x/(1 - x).
Sum_{n >= 1} (1/n^2)*a(n)*x^n = L(x) - (6/7^2)*L(x^7) - (6/49^2)*L(x^49) - (6/343^2)*L(x^343) - ..., where L(x) = Log(1/(1 - x)).
Also, Sum_{n >= 1} (1/a(n))*x^n = L(x) + (6/7)*L(x^7) + (6/7)*L(x^49) + (6/7)*L(x^343) ... . (End)
		

Crossrefs

Programs

  • Mathematica
    Table[n/7^IntegerExponent[n, 7], {n, 80}] (* Alonso del Arte, Jun 18 2014 *)
  • PARI
    a(n) = f = factor(n);  for (i=1, #f~, if (f[i,1]==7, f[i, 1]=1)); factorback(f); \\ Michel Marcus, Jun 18 2014
    
  • PARI
    a(n) = n \ 7^valuation(n, 7) \\ David A. Corneth, Feb 21 2019
    
  • Python
    def A242603(n):
        for i in range(n,0,-1):
            if n%i==0 and i%7!=0:
                return i # Indranil Ghosh, Jan 31 2017

Formula

Multiplicative with a(p^e) = 1 if p = 7, else p^e.
Dirichlet g.f.: zeta(s-1)*7*(7^(s-1) - 1)/(7^s - 1).
a(n) = n/A268354(n).
From Peter Bala, Feb 21 2019: (Start)
a(n) = n/gcd(n,7^n).
O.g.f.: F(x) - 6*F(x^7) - 6*F(x^49) - 6*F(x^243) - ..., where F(x) = x/(1 - x)^2 is the generating function for the positive integers. More generally, for m >= 1,
Sum_{n >= 0} (a(n)^m)*x^n = F(m,x) - (7^m - 1)( F(m,x^7) + F(m,x^49) + F(m,x^243) + ...), where F(m,x) = A(m,x)/(1 - x)^(m+1) with A(m,x) the m_th Eulerian polynomial: A(1,x) = x, A(2,x) = x*(1 + x), A(3,x) = x*(1 + 4*x + x^2) - see A008292.
Repeatedly applying the Euler operator x*d/dx or its inverse operator to the o.g.f. for the sequence a(n) produces generating functions for the sequences (n^m*a(n))n>=1, m in Z. Some examples are given below. (End)
Sum_{k=1..n} a(k) ~ (7/16) * n^2. - Amiram Eldar, Nov 28 2022

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

A373217 Expansion of Sum_{k>=0} x^(7^k) / (1 - x^(7^k)).

Original entry on oeis.org

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

Views

Author

Seiichi Manyama, May 28 2024

Keywords

Comments

The number of powers of 7 that divide n. - Amiram Eldar, Mar 29 2025

Crossrefs

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
Showing 1-10 of 20 results. Next