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.

Previous Showing 31-40 of 53 results. Next

A180017 Difference of sums of digits of n in ternary and in binary.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 06 2010

Keywords

Comments

This sequence is positive on average, since 1/log(3) > 1/log(4). Do all integers appear infinitely often? - Charles R Greathouse IV, Feb 07 2013

Examples

			For n = 7 = 21_3 = 111_2, a(n) = (2+1) - (1+1+1) = 0.
For n = 8 = 22_3 = 1000_2, a(n) = (2+2) - (1+0+0+0) = 3.
For n = 9 = 100_3 = 1001_2, a(n) = (1+0+0) - (1+0+0+1) = -1.
		

Crossrefs

Programs

  • Mathematica
    Table[Total[IntegerDigits[n,3]]-Total[IntegerDigits[n,2]],{n,0,100}] (* Harvey P. Dale, Dec 08 2015 *)
  • PARI
    a(n) = sumdigits(n,3) - sumdigits(n,2); \\ Michel Marcus, Nov 12 2023

Formula

a(n) = A053735(n) - A000120(n);
a(A037301(n)) = 0;
a(A000244(n)) = 1 - A000120(A000244(n));
a(A000079(n)) = A053735(A000079(n)) - 1;
a(A024023(n)) = 2*n - A000120(A024023(n)); a(A000225(n)) = A053735(A000225(n)) - n.
a(n) = A011371(n) - 2*A054861(n). - Henry Bottomley, Feb 16 2024

A064459 a(n) = Sum_{k>=1} floor(n/12^k).

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Oct 03 2001

Keywords

Comments

Original incorrect name was: "Highest power of 12 dividing n!": that sequence is A090619. If p is prime, Legendre's formula says the highest power of p dividing n! is Sum_{k>=1} floor(n/p^k), but of course 12 is not prime. - Robert Israel, Mar 23 2018

Crossrefs

Programs

  • GAP
    List([0..110],n->Sum([1..n],k-?Int(n/(12^k)))); # Muniru A Asiru, Mar 24 2018
  • Maple
    f:= proc(n) add(floor(n/12^k), k=1..floor(log[12](n))) end proc:
    f(0):= 0:
    map(f, [$0..100]); # Robert Israel, Mar 23 2018
  • Mathematica
    Table[t = 0; p = 12; While[s = Floor[n/p]; t = t + s; s > 0, p *= 12]; t, {n, 0, 100} ]
    Join[{0},Accumulate[Table[If[Divisible[n,12],1,0],{n,110}]]] (* Harvey P. Dale, Feb 14 2016 *)
  • PARI
    { for (n=0, 1000, a=0; p=12; while (s = n\p, a+=s; p*=12); write("b064459.txt", n, " ", a) ) } \\ Harry J. Smith, Sep 15 2009
    

Formula

a(n) = floor[n/12] + floor[n/144] + floor[n/1728] + floor[n/20736] + ....

Extensions

Corrected by Robert Israel, Mar 23 2018

A090618 Highest power of 9 dividing n!.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 13, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 20, 20, 20, 20
Offset: 0

Views

Author

Henry Bottomley, Dec 06 2003

Keywords

Examples

			a(9)=2 since 9!=362880=9^2*4480.
		

Crossrefs

Programs

  • Mathematica
    IntegerExponent[Range[0,90]!,9] (* Harvey P. Dale, Jun 07 2016 *)

Formula

a(n) =A090622(n, 9) =[A054861(n)/2] =[([n/3]+[n/9]+[n/27]+[n/81]+...)/2].

A090619 Highest power of 12 dividing n!.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 5, 6, 6, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 15, 17, 17, 17, 17, 18, 18, 19, 19, 19, 20, 21, 21, 22, 22, 22, 23, 23, 23, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 30, 30, 31, 31, 31, 32, 32, 32, 34, 34, 34, 35, 35
Offset: 0

Views

Author

Henry Bottomley, Dec 06 2003

Keywords

Comments

Most sequences of the form "highest power of k dividing n!" essentially depend on one of the primes or prime powers dividing k. But in this case, the sequences with k=3 (A054861) and k=4 (A090616) are both close to n/2 and vary in which one is lower for different values of n.
a(2^n) = A090616(2^n) and a(3^n-1) = A090616(3^n-1) while a(2^n-1) = A054861(2^n-1) and a(3^n) = A054861(3^n). - Robert Israel, Mar 25 2018

Examples

			a(6)=2 since 6!=720=12^2*5.
		

Crossrefs

Programs

  • Maple
    f2:= n -> n - convert(convert(n,base,2),`+`):
    f3:= n -> (n - convert(convert(n,base,3),`+`))/2:
    f:= n -> min(f3(n), floor(f2(n)/2)):
    f(0):= 0:
    map(f, [$0..100]); # Robert Israel, Mar 23 2018
  • Mathematica
    Table[IntegerExponent[n!, 12], {n, 0, 100}] (* Jean-François Alcover, Mar 26 2018 *)
  • PARI
    a(n) = valuation(n!, 12); \\ Michel Marcus, Mar 24 2018

Formula

a(n) =A090622(n, 12) =min(A054861(n), A090616(n)). Close to n/2, indeed for n>3: n/2-log3(n+1) <= a(n) < n/2.

A261237 Number of steps needed when starting from (3^(n+1))-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k) to encounter the first number whose base-3 representation begins with a digit other than 2.

Original entry on oeis.org

1, 1, 2, 5, 13, 34, 92, 251, 687, 1885, 5184, 14292, 39557, 110094, 308351, 868716, 2458964, 6984467, 19890809, 56775186, 162427605, 465816503, 1339163192, 3858600035, 11138726760, 32199805820
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Comments

a(n) = How many numbers whose base-3 representation begins with digit "2" are encountered before (3^n)-1 is reached when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k by k - (sum of digits in base-3 representation of k). Note that (3^n)-1 (in base-3: "222...", with digit "2" repeated n times) is not included in the count, although the starting point (3^(n+1))-1 is.

Examples

			For n=0, we start from 3^(0+1) - 1 = 2 (also "2" in base-3), and subtract 2 to get 0, which doesn't begin with 2, thus a(0) = 1.
For n=1, we start from 3^(1+1) - 1 = 8 ("22" in base-3), and subtract 2*2 = 4 to get 4 ("11" in base-3) which doesn't begin with 2, thus a(1) = 1.
For n=2, we start from 3^(2+1) - 1 = 26 ("222" in base-3), and subtract first 6 to get 20 ("202" in base-3), from which we subtract 4, to get 16 ("121" in base-3), so in two steps we have reached the first such number that does not begin with "2" in base-3, thus a(2) = 2.
		

Crossrefs

Programs

  • C
    /* Use the C-program given in A261234. */
    
  • Mathematica
    Flatten@ Table[FirstPosition[#, k_ /; k != 2] &@ Map[First@ IntegerDigits[#, 3] &, NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &]] - 1, {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • PARI
    a(n)=my(k=3^(n+1)-1,t=2*3^n,s); while(k>=t, k-=sumdigits(k,3); s++); s \\ Charles R Greathouse IV, Aug 21 2015
  • Scheme
    (definec (A261237 n) (let loop ((k (- (A000244 (+ 1 n)) 1)) (s 0)) (if (< (A122586 k) 2) s (loop (* 2 (A054861 k)) (+ 1 s)))))
    

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016

A375933 The second-largest exponent in the prime factorization of n, or 0 if it does not exist.

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Sep 03 2024

Keywords

Comments

First differs from A363127 at n = 60, and from A363131 at n = 72.
The position of the first occurrence of k = 1, 2, ..., is A167747(k+1) = 2*6^k.

Examples

			12 = 2^2 * 3^1 has 2 exponents in its prime factorization: 1 and 2. 2 is the largest and 1 is the second-largest. Therefore a(12) = 1.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{e = FactorInteger[n][[;; , 2]]}, Max[0, Max[Select[e, # < Max[e] &]]]]; Array[a, 100]
  • PARI
    a(n) = if(n == 1, 0, my(e = factor(n)[,2]); e = select(x -> x < vecmax(e), e); if(#e == 0, 0, vecmax(e)));

Formula

a(n) = A051903(A375932(n)).
a(n) = 0 if and only if n is a power of a squarefree number (A072774).
a(n) = 1 if and only if n is in A375934.
a(n) <= A051903(n), with equality if and only if n = 1.
a(n!) = A054861(n) for n != 3.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{i >= 1} i * d(i) = 0.42745228287872473252..., where d(i) = Sum_{j >= i+1} d_2(i, j) and d_2(i, j) = Product_{p prime} (1 - 1/p^(i+1) + 1/p^j - 1/p^(j+1)) - Product_{p prime} (1 - 1/p^(i+1)) + [i > 1] * (Product_{p prime} (1 - 1/p^i) - Product_{p prime} (1 - 1/p^i + 1/p^j - 1/p^(j+1))), and [] is the Iverson bracket.

A054900 a(n) = Sum_{j >= 1} floor(n/16^j).

Original entry on oeis.org

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

Views

Author

Henry Bottomley, May 23 2000

Keywords

Crossrefs

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

Programs

  • Magma
    m:=16;
    function a(n) // a = A054900, m = 16
      if n eq 0 then return 0;
      else return a(Floor(n/m)) + Floor(n/m);
      end if; end function;
    [a(n): n in [0..127]]; // G. C. Greubel, Apr 28 2023
    
  • Mathematica
    a[n_, m_]:= If[n==0, 0, a[Floor[n/m], m] +Floor[n/m]];
    Table[a[n, 16], {n,0,127}] (* G. C. Greubel, Apr 28 2023 *)
  • SageMath
    m=16 # a = A054900
    def a(n): return 0 if (n==0) else a(n//m) + (n//m)
    [a(n) for n in range(128)] # G. C. Greubel, Apr 28 2023

Formula

a(n) = (n - A053836(n))/15.
From Hieronymus Fischer, Aug 14 2007: (Start)
Recurrence:
a(n) = a(floor(n/16)) + floor(n/16).
a(16*n) = a(n) + n.
a(n*16^m) = a(n) + n*(16^m - 1)/15.
a(k*16^m) = k*(16^m - 1)/15, for 0 <= k < 16, m>=0.
Asymptotic behavior:
a(n) = n/15 + O(log(n)).
a(n+1) - a(n) = O(log(n)) (this follows from the inequalities below).
a(n) <= (n-1)/15; equality holds for powers of 16.
a(n) >= (n-15)/15 - floor(log_16(n)); equality holds for n = 16^m - 1, m > 0.
Limits:
lim inf (n/15 - a(n)) = 1/15, for n --> oo.
lim sup (n/15 - log_16(n) - a(n)) = 0, for n --> oo.
lim sup (a(n+1) - a(n) - log_16(n)) = 0, for n --> oo.
Series:
G.f.: (1/(1-x))*Sum_{k > 0} x^(16^k)/(1-x^(16^k)). (End)

A089792 a(n) = n-(exponent of highest power of 3 dividing n!).

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 5, 6, 7, 7, 8, 9, 9, 10, 11, 10, 11, 12, 12, 13, 14, 14, 15, 16, 14, 15, 16, 16, 17, 18, 18, 19, 20, 19, 20, 21, 21, 22, 23, 23, 24, 25, 24, 25, 26, 26, 27, 28, 28, 29, 30, 28, 29, 30, 30, 31, 32, 32, 33, 34, 33
Offset: 0

Views

Author

Paul Boddington, Jan 09 2004

Keywords

Comments

The exponent of the highest power of 3 dividing binomial(n,k) is given by a(k)+a(n-k)-a(n).

Crossrefs

Programs

  • Mathematica
    Table[n-IntegerExponent[n!,3],{n,0,70}] (* Harvey P. Dale, Aug 09 2015 *)
  • PARI
    vector(70, n, n--; n-valuation(n!, 3)) \\ Michel Marcus, Aug 19 2015

Formula

a(n) = a(n-1)+1-A007949(n).
a(n) = log(denominator(n!/3^n))/log(3); a(n) = log_3(A125824(n)). - Paul Barry, Apr 02 2007
a(n) = n - A054861(n).

A193260 G.f.: x+x^2 = Sum_{n>=1} x^n * ((1+x+x^2)^n - x^(2*n)) / (1+x+x^2)^a(n).

Original entry on oeis.org

1, 2, 5, 6, 7, 9, 10, 11, 15, 16, 17, 19, 20, 21, 23, 24, 25, 28, 29, 30, 32, 33, 34, 36, 37, 38, 43, 44, 45, 47, 48, 49, 51, 52, 53, 56, 57, 58, 60, 61, 62, 64, 65, 66, 69, 70, 71, 73, 74, 75, 77, 78, 79, 83, 84, 85, 87, 88, 89, 91, 92, 93, 96, 97, 98, 100, 101, 102, 104, 105, 106, 109, 110, 111, 113, 114, 115, 117, 118, 119, 125, 126, 127, 129, 130, 131, 133, 134, 135
Offset: 1

Views

Author

Paul D. Hanna, Jul 19 2011

Keywords

Examples

			G.f.: x+x^2 = x*((1+x+x^2) - x^2)/(1+x+x^2)  + x^2*((1+x+x^2)^2 - x^4)/(1+x+x^2)^2  + x^3*((1+x+x^2)^3 - x^6)/(1+x+x^2)^5  + x^4*((1+x+x^2)^4 - x^8)/(1+x+x^2)^6  + x^5*((1+x+x^2)^5 - x^10)/(1+x+x^2)^7  + x^6*((1+x+x^2)^6 - x^12)/(1+x+x^2)^9  + x^7*((1+x+x^2)^7 - x^14)/(1+x+x^2)^10  + x^8*((1+x+x^2)^8 - x^16)/(1+x+x^2)^11  + x^9*((1+x+x^2)^9 - x^18)/(1+x+x^2)^15 +...+ x^n*((1+x+x^2)^n - x^(2*n))/(1+x+x^2)^a(n) +...
		

Crossrefs

Programs

  • Mathematica
    Table[n+Floor[Log[3,n]]+IntegerExponent[n!,3],{n,90}] (* Harvey P. Dale, Oct 10 2012 *)
  • PARI
    {a(n)=if(n<1,0,n + floor(log(n+1/2)/log(3)) + valuation(n!,3))}
    
  • PARI
    {a(n)=if(n<1,0,if(n==1,1,polcoeff(sum(m=1,n+1,x^m*((1+x+x^2)^m-x^(2*m))/(1+x+x^2 +x^2*O(x^n))^if(m>=n,1,a(m)))+x^(n+1),n+1)))}

Formula

a(n) = n + floor(log_3(n)) + A054861(n) for n>=1, where A054861(n) = highest power of 3 dividing n!.

A217445 Numbers n such that n! has the same number of terminating zeros in bases 3 and 4.

Original entry on oeis.org

1, 2, 4, 5, 6, 7, 10, 11, 12, 13, 14, 18, 19, 21, 22, 23, 33, 36, 37, 38, 42, 43, 46, 47, 51, 56, 58, 59, 60, 61, 62, 75, 86, 88, 89, 92, 100, 101, 102, 103, 105, 112, 113, 114, 115, 120, 121, 122, 124, 125, 138, 139, 141, 147, 153, 159, 164, 166, 167, 168
Offset: 1

Views

Author

Tanya Khovanova, Oct 03 2012

Keywords

Comments

The number of zeros of n! base 3 is approaching n/2 as n grows. Similarly, the number of zeros of n! base 4 is approaching n/2 as n grows. Consequently, this sequence is expected to have high density.
From Robert Israel, Jan 19 2017: (Start)
Numbers n such that A000120(n) + (n + A000120(n) mod 2) = A053735(n).
Since typically A000120(n) ~ log_2(n) while typically A053735(n) ~ log_3(n), the density of this sequence should go to 0, contrary to the previous comment. (End)
Comment from N. J. A. Sloane, Dec 06 2019: (Start)
Appears to be the same as the list of positive numbers n such that the last nonzero digit of n! in base 12 belongs to the set [1, 2, 5, 7, 10, 11].
The first footnote in Deshouillers et al. (2016) says: "if the last nonzero digit of n! in base 12 belongs to {1, 2, 5, 7, 10, 11} then |(digit-sum of n in base 3) - (digit-sum of n in base 2)| is <= 1; this seems to occur infinitely many times." Compare A096288. (End)

Examples

			6! is 222200 in base 3 and 23100 in base 4, both of them have 2 zeros at the end, so 6 is in the sequence.
		

References

  • Jean-Marc Deshouillers, Laurent Habsieger, Shanta Laishram, Bernard Landreau, Sums of the digits in bases 2 and 3, arXiv:1611.08180, 2016

Crossrefs

Cf. A054861 (base 3), A090616 (base 4), A090622, A096288.

Programs

  • Maple
    s2:= n -> convert(convert(n,base,2),`+`):
    s3:= n -> convert(convert(n,base,3),`+`):
    select(n -> s2(n) + (n+s2(n) mod 2) = s3(n), [$1..1000]); # Robert Israel, Jan 19 2017
  • Mathematica
    sntzQ[n_]:=Module[{f=n!},Last[Split[IntegerDigits[f,3]]]==Last[ Split[ IntegerDigits[ f,4]]]]; Select[Range[200],sntzQ] (* Harvey P. Dale, Jul 11 2020 *)
  • PARI
    is(n)=my(L=log(n+1));sum(k=1,L\log(3),n\3^k)==sum(k=1,L\log(2),n>>k)\2 \\ Charles R Greathouse IV, Oct 04 2012

Extensions

More terms from Alois P. Heinz, Oct 03 2012
Previous Showing 31-40 of 53 results. Next