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 21-29 of 29 results.

A365458 The largest power of 3 that is less than or equal to n.

Original entry on oeis.org

1, 1, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 81, 81, 81, 81, 81
Offset: 1

Views

Author

Antti Karttunen, Sep 17 2023

Keywords

Examples

			a(2) = 1 because 3^0 = 1 <= 2.
a(3) = 3 because 3^1 = 3 <= 3.
a(4) = 3 because 3^1 = 3 <= 4.
		

Crossrefs

Programs

  • Mathematica
    Array[3^Floor@ Log[3, #] &, 90] (* Michael De Vlieger, Sep 17 2023 *)
  • PARI
    A365458(n) = if(1==n,n,my(k=0); while((3^k) < n, k++); if((3^k) > n,k--); (3^k));
    
  • PARI
    a(n) = 3^logint(n, 3); \\ Michel Marcus, Sep 17 2023
    
  • Python
    def A365458(n):
        kmin, kmax = 0, 1
        while 3**kmax <= n:
            kmax <<= 1
        while True:
            kmid = kmax+kmin>>1
            if 3**kmid > n:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return 3**kmin # Chai Wah Wu, Sep 17 2023

Formula

a(n) = 3^floor((log n) / (log 3)). - Michael De Vlieger, Sep 17 2023
a(n) = A000244(A062153(n)). - Michel Marcus, Sep 17 2023

A081063 Number of numbers <= n that are 3-smooth or prime powers.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 04 2003

Keywords

Comments

a(n) = #{A081061(k): 1<=k<=n}.

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[If[PrimePowerQ[n]||Max[FactorInteger[n][[All,1]]]<5,1,0],{n,80}]] (* Harvey P. Dale, Nov 29 2020 *)
  • Python
    from sympy import integer_log, primepi, integer_nthroot
    def A081063(n): return int(1-(a:=n.bit_length())-(b:=integer_log(n,3)[0])+sum((n//3**i).bit_length() for i in range(b+1))+sum(primepi(integer_nthroot(n, k)[0]) for k in range(1, a))) # Chai Wah Wu, Sep 16 2024

Formula

a(n)=A071521(n)+A065515(n)-A000523(n)-A062153(n)+1.

A374054 a(n) = max_{i=0..n} S_3(i) + S_3(n-i) where S_3(x) = A053735(x) is the base-3 digit sum of x.

Original entry on oeis.org

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

Views

Author

Hermann Gruber, Jun 26 2024

Keywords

Comments

As shown in the proof of [Gruber and Holzer, lemma 9], the maximum is attained by choosing i as the largest number not exceeding n whose ternary representation is (22...2)_3. By [Gruber and Holzer, lemma 6], for this choice of i we have S_3(i) = 2*floor(log_3(n+1)) and S_3(n-i) = S_3(n+1)-1, giving the formula below.

Examples

			For n=31, the maximum is attained by 26 + 5 = (222)_3 + (12)_3. Using 32=(1021)_3, comparing with the formula above, S_3(26) = 2*floor(log_3(n+1)) = 6 and S_3(5) = S_3(31+1)-1 = 3. Notice that other pairs attain the maximum as well, namely 23 + 8 = (22)_3 + (212)_3, as well as 20 + 11 = (202)_3 + (102)_3.
		

References

  • Hermann Gruber and Markus Holzer, Optimal Regular Expressions for Palindromes of Given Length. Extended journal version, in preparation, 2024.

Crossrefs

Programs

  • Maple
    f:= n -> 2 * ilog[3](n+1) + convert(convert(n+1,base,3),`+`) - 1:
    map(f, [$0..100]); # Robert Israel, Jun 27 2024
  • Mathematica
    Table[2*Floor[Log[3, k]] + DigitSum[k, 3] - 1, {k, 100}] (* Paolo Xausa, Aug 01 2024 *)
  • PARI
    a(n) = 2*logint(n+1, 3) + sumdigits(n+1, 3) - 1; \\ Michel Marcus, Jul 05 2024

Formula

a(n) = 2*floor(log_3(n+1)) + A053735(n+1) - 1 [Gruber and Holzer, lemma 9].

A069924 Number of k, 1<=k<=n, such that phi(k) divides k.

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15
Offset: 1

Views

Author

Benoit Cloitre, May 05 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Range[n], Divisible[#, EulerPhi[#]] &]], {n, 1, 100}] (* Vaclav Kotesovec, Feb 16 2019 *)
    Accumulate[Table[If[Divisible[n,EulerPhi[n]],1,0],{n,80}]] (* Harvey P. Dale, Jul 04 2021 *)
  • PARI
    for(n=1,150,print1(sum(i=1,n,if(i%eulerphi(i),0,1)),","))

Formula

a(n) = Card(k: 1<=k<=n : k==0 (mod phi(k))) asymptotically: a(n) = C*log(n)^2 + o(log(n)^2) with C=0.6....
a(n) = A071521(n) - A062153(n). - Ridouane Oudra, Mar 05 2025

A206722 Parameters of Chebyshev function psi.

Original entry on oeis.org

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

Views

Author

John W. Nicholson, Feb 11 2012

Keywords

Comments

a(x,n) is the exponent k such that prime(n)^k <= x and x < prime(n)^(k+1).
psi(x) = Sum_{p_n <= x} k*log(p_n), where a(x,n) = k is the unique integer such that p_n^k <= x but p_n^(k+1) > x.
Related to Firoozbakht's Conjecture (1982): p_n^(1/n) > p_(n+1)^(1/(n+1)) for all n >= 1.

Examples

			If x = 7, then 2^2, 3^1, 5^1, 7^1 <= x < 2^3, 3^2, 5^2, 7^2, respectively so k = 2, 1, 1, 1, respectively.
The table starts in row x=2 with columns n >= 1 as:
  1;
  1, 1;
  2, 1;
  2, 1, 1;
  2, 1, 1;
  2, 1, 1, 1;
  3, 1, 1, 1;
  3, 2, 1, 1;
  3, 2, 1, 1, 1;
		

Crossrefs

Columns: A000523 (n=1), A062153 (n=2).

Programs

  • Mathematica
    A206722[x_, n_] := Module[{p = Prime[n]}, For[k = 0, True, k++, If[p^(k+1) > x && p^k <= x, Return[k]]]];
    Table[DeleteCases[Table[A206722[x, n], {n, 1, 17}], 0], {x, 2, 20}] // Flatten (* Jean-François Alcover, Sep 15 2018, after R. J. Mathar *)
  • Maxima
    prime(n) := block(
        if n = 1 then
           return(2)
        else
        return(next_prime(prime(n-1)))
    )$ /* very slow recursive definition of A000040 */
    A206722(x,n) := block(
        local(p),
        p : prime ( n ),
        for k : 0 do (
           if p^(k+1) > x and p^k <= x then
              return(k)
           )
    )$
    for x : 2 thru 20 do (
        for n : 1 thru 17 do
          sprint(A206722(x,n)),
        newline()
    )$ /* R. J. Mathar, Feb 14 2012 */

A329195 a(n) = floor(log_5(n^2)) = floor(2 log_5(n)).

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Nov 07 2019

Keywords

Crossrefs

Cf. A000290 (n^2), A062153 (log_3), A329202 (log_2(n^2)), A329193 (log_2(n^3)), A329194 (log_3(n^2)).

Programs

  • Mathematica
    Table[Floor[2Log[5,n]],{n,100}] (* Harvey P. Dale, Dec 14 2021 *)
  • PARI
    apply( A329195(n)=logint(n^2,5), [1..99])

A329199 a(n) = round(log_3(n)).

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Nov 07 2019

Keywords

Crossrefs

Cf. A062153 (floor log_3), A000523 (floor log_2), A004257 (round log_2), A029837 (ceiling log_2), A329194 (log_3(n^2)).

Programs

  • Mathematica
    Round[Log[3,Range[100]]] (* Harvey P. Dale, Sep 06 2022 *)
  • PARI
    apply( A329199(n)=log(n)\/log(3), [1..130])

A280724 Expansion of 1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(3^k).

Original entry on oeis.org

1, 2, 3, 5, 7, 9, 11, 13, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 07 2017

Keywords

Comments

Sums of lengths of ternary numbers (A007089).

Examples

			-----------------------
n  base 3 length  a(n)
-----------------------
0 |  0   |  1   |  1
1 |  1   |  1   |  2
2 |  2   |  1   |  3
3 |  10  |  2   |  5
4 |  11  |  2   |  7
5 |  12  |  2   |  9
6 |  20  |  2   |  11
7 |  21  |  2   |  13
8 |  22  |  2   |  15
9 |  100 |  3   |  18
-----------------------
		

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[1/(1 - x) + (1/(1 - x)^2) Sum[x^3^k, {k, 0, 15}], {x, 0, 70}], x]
    Table[1 + Sum[Floor[Log[3, k]] + 1, {k, 1, n}], {n, 0, 70}]

Formula

G.f.: 1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(3^k).
a(n) = 1 + Sum_{k=1..n} floor(log_3(k)) + 1.

A333355 Number of bits in binary expansion of n minus the number of digits of n when written in base 3.

Original entry on oeis.org

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

Views

Author

Frank Ellermann, Mar 15 2020

Keywords

Comments

Record highs are at n = 2^A054414. All n=2^k >= 2 are increases, all n=3^j are decreases, and there is either one or none 3^j between 2^(k-1) and 2^k. When one, a(2^k) = a(2^(k-1)) so not a record high. When none, a(2^k) = a(2^(k-1)) + 1 which is a record high. If 2^k and 2^(k-1) are the same length in ternary then there is no 3^j between them. This is when 2^k has most significant ternary digit 2 since 2^(k-1) >= 3^j is 2^k >= 2*3^j. These k are A054414. Non-record increases are at its complement n = 2^A020914 >= 2. - Kevin Ryde, Apr 04 2020

Examples

			a(8) = 2 = 4 - 2 for binary 1000 and ternary 22.
a(64) = 3 = 7 - 4 for binary 1000000 and ternary 2101.
		

Crossrefs

Cf. A007088 ( binary), A000523 (floor(log_2(n))), A029837.
Cf. A007089 (ternary), A062153 (floor(log_3(n))), A117966.

Programs

  • Maple
    a:= n-> ilog[2](n)-ilog[3](n):
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 15 2020
  • Mathematica
    a[n_]: = Floor @ Log[2, n] - Floor @ Log[3, n]; Array[a, 100] (* Amiram Eldar, Mar 16 2020 *)
  • PARI
    a(n) = logint(n,2) - logint(n,3); \\ Kevin Ryde, May 15 2020
  • Rexx
    L = 1 ;  M = 1 ;  B = 2 ;  T = 3       ;  S = 0
    do N = 2 while length( S ) < 258
       if B = N then  do    ;  B = B * 2   ;  L = L + 1   ;  end
       if T = N then  do    ;  T = T * 3   ;  M = M + 1   ;  end
       S = S || ',' L - M
    end N
    say S                   ;  return S
    

Formula

a(n) = A000523(n) - A062153(n) = floor(log_2(n)) - floor(log_3(n)).
a(n) = length(A007088(n)) - length(A007089(n)).
Previous Showing 21-29 of 29 results.