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-8 of 8 results.

A169594 Number of divisors of n, counting divisor multiplicity in n.

Original entry on oeis.org

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

Views

Author

Joseph L. Pe, Dec 02 2009

Keywords

Comments

The multiplicity of a divisor d > 1 in n is defined as the largest power i for which d^i divides n; and for d = 1 it is defined as 1.
a(n) is also the sum of the multiplicities of the divisors of n.
In other words, a(n) = 1 + sum of the highest exponents e_i for which each number k_i in range 2 .. n divide n, as {k_i}^{e_i} | n. For nondivisors of n this exponent e_i is 0, for n itself it is 1. - Antti Karttunen, May 20 2017
From Gus Wiseman, Mar 25 2021: (Start)
Also the number of strict chains of divisors ending with n and having constant (equal) first quotients. The case starting with 1 is A089723. For example, the a(1) = 1 through a(12) = 7 chains are:
1 2 3 4 5 6 7 8 9 10 11 12
1|2 1|3 1|4 1|5 1|6 1|7 1|8 1|9 1|10 1|11 1|12
2|4 2|6 2|8 3|9 2|10 2|12
1|2|4 3|6 4|8 1|3|9 5|10 3|12
2|4|8 4|12
1|2|4|8 6|12
3|6|12
(End)
a(n) depends only on the prime signature of n. - David A. Corneth, Mar 28 2021

Examples

			The divisors of 8 are 1, 2, 4, 8 of multiplicity 1, 3, 1, 1, respectively. So a(8) = 1 + 3 + 1 + 1 = 6.
		

Crossrefs

Cf. A168512.
Row sums of A286561, A286563 and A286564.
A001055 counts factorizations (strict: A045778, ordered: A074206).
A057567 counts chains of divisors with weakly increasing first quotients.
A067824 counts strict chains of divisors ending with n.
A253249 counts strict chains of divisors.
A334997 counts chains of divisors of n by length.
A342086 counts chains of divisors with strictly increasing first quotients.
A342496 counts partitions with equal first quotients (strict: A342515, ranking: A342522, ordered: A342495).
A342530 counts chains of divisors with distinct first quotients.
First differences of A078651.

Programs

  • Maple
    a := n -> ifelse(n < 2, 1, 1 + add(padic:-ordp(n, k), k = 2..n)):
    seq(a(n), n = 1..98);  # Peter Luschny, Apr 10 2025
  • Mathematica
    divmult[d_, n_] := Module[{output, i}, If[d == 1, output = 1, If[d == n, output = 1, i = 0; While[Mod[n, d^(i + 1)] == 0, i = i + 1]; output = i]]; output]; dmt0[n_] := Module[{divs, l}, divs = Divisors[n]; l = Length[divs]; Sum[divmult[divs[[i]], n], {i, 1, l}]]; Table[dmt0[i], {i, 1, 40}]
    Table[1 + DivisorSum[n, IntegerExponent[n, #] &, # > 1 &], {n, 98}] (* Michael De Vlieger, May 20 2017 *)
  • PARI
    A286561(n,k) = { my(i=1); if(1==k, 1, while(!(n%(k^i)), i = i+1); (i-1)); };
    A169594(n) = sumdiv(n,d,A286561(n,d)); \\ Antti Karttunen, May 20 2017
    
  • PARI
    a(n) = { if(n == 1, return(1)); my(f = factor(n), u = vecmax(f[, 2]), cf = f, res = numdiv(f) - u + 1); for(i = 2, u, cf[, 2] = f[, 2]\i; res+=numdiv(factorback(cf)) ); res } \\ David A. Corneth, Mar 29 2021
    
  • PARI
    A169594(n) = {my(s=0, k=2); while(k<=n, s+=valuation(n, k); k=k+1); s + 1} \\ Zhuorui He, Aug 28 2025
    
  • Python
    def a286561(n, k):
        i=1
        if k==1: return 1
        while n%(k**i)==0:
            i+=1
        return i-1
    def a(n): return sum([a286561(n, d) for d in divisors(n)]) # Indranil Ghosh, May 20 2017
  • Scheme
    (define (A169594 n) (add (lambda (k) (A286561bi n k)) 1 n))
    ;; Implements sum_{i=lowlim..uplim} intfun(i)
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
    ;; For A286561bi see A286561. - Antti Karttunen, May 20 2017
    

Formula

From Friedjof Tellkamp, Feb 29 2024: (Start)
a(n) = A309891(n) + 1.
G.f.: x/(1-x) + Sum_{k>=2, j>=1} x^(k^j)/(1-x^(k^j)).
Dirichlet g.f.: zeta(s) * (1 + Sum_{k>=1} (zeta(k*s) - 1)).
Sum_{n>=1} a(n)/n^2 = (7/24) * Pi^2. (End)

Extensions

Extended by Ray Chandler, Dec 08 2009

A051336 Number of increasing arithmetic progressions in {1,2,3,...,n}, including trivial arithmetic progressions of lengths 1 and 2.

Original entry on oeis.org

1, 3, 7, 13, 22, 33, 48, 65, 86, 110, 138, 168, 204, 242, 284, 330, 381, 434, 493, 554, 621, 692, 767, 844, 929, 1017, 1109, 1205, 1307, 1411, 1523, 1637, 1757, 1881, 2009, 2141, 2282, 2425, 2572, 2723, 2882, 3043, 3212, 3383, 3560, 3743, 3930, 4119
Offset: 1

Views

Author

John W. Layman, Nov 02 1999

Keywords

Comments

The number of arithmetic subsequences of [1, ..., n] with successive-term increment i and length k is (n-i*(k-1))(i > 0, k > 0, n > i*(k-1)). - Robert E. Sawyer (rs.1(AT)mindspring.com)
The best algorithm known for generating a(n) from scratch has order O(sqrt(n)) (see below). If a(n-1) is known, it reduces to O(n^(1/3)). - Daniel Hoying, May 20 2020

Examples

			a(1): [1];
a(2): [1],[2],[1,2];
a(3): [1],[2],[3],[1,2],[1,3],[2,3],[1,2,3].
		

Crossrefs

Cf. A078567.
See A078651 and A366471 for GPs.

Programs

  • Mathematica
    nmax = 48; t = Table[ DivisorSigma[0, n], {n, 1, nmax}]; Accumulate[ Accumulate[t]+1] - Accumulate[t] (* Jean-François Alcover, Nov 08 2011 *)
    With[{c=Accumulate[DivisorSigma[0,Range[50]]]},Accumulate[c+1]-c] (* Harvey P. Dale, Dec 23 2015 *)
    nmax = 50; RecurrenceTable[{a[n] == a[n-1]+1+p[n], p[n] == p[n-1]+DivisorSigma[0, n-1], a[1] == 1, p[1] == 0}, {a, p}, {n, 1, nmax}][[All,1]] (* Daniel Hoying, May 16 2020 *)
  • Python
    from math import isqrt
    def A051336(n): return (((s:=isqrt(n-1))*(s+1))**2>>2)+(1-s**2)*n+sum((q:=(n-1)//k)*(2*n-k*(1+q)) for k in range(1, s+1)) # Chai Wah Wu, Oct 21 2023

Formula

Theorem: the second differences give tau(n+1), the number of divisors of n+1 (A000005).
a(n) = n + A078567(n).
a(n) = n + Sum_{ i=1..n-1, j=1..floor(n/i) } (n - i*j). - Robert E. Sawyer (rs.1(AT)mindspring.com)
From Daniel Hoying, May 15 2020: (Start)
a(n+1) = a(n) + 1 + Sum_{i=1..n} tau(i).
= a(n) + 1 + A006218(n+1).
a(n+1) = (n + 1)*(1 + Sum_{i=1..n} floor(n/i)) - Sum_{i=1..n} i*tau(i).
= (n + 1)*(1 + A006218(n)) - A143127(n). (End)

A366471 Number of increasing geometric progressions in {1,2,3,...,n} with rational ratio.

Original entry on oeis.org

1, 3, 6, 11, 16, 22, 29, 39, 50, 60, 71, 84, 97, 111, 126, 147, 164, 184, 203, 224, 245, 267, 290, 316, 345, 371, 402, 431, 460, 490, 521, 559, 592, 626, 661, 702, 739, 777, 816, 858, 899, 941, 984, 1029, 1076, 1122, 1169, 1222, 1277, 1331, 1382, 1435, 1488, 1546, 1601, 1659, 1716, 1774, 1833, 1894, 1955
Offset: 1

Views

Author

Keywords

Examples

			For n = 6, the a(6) = 22 GPs are: all 6 singletons, all 15 pairs, and one triple 1,2,4.
		

Crossrefs

See A078651 for case of integral ratios, also A051336 for APs.
Row sums of A366472.
Cf. A365677 (length >= 3), A000010.

Programs

  • Maple
    with(numtheory);
    A366471 := proc(n) local a,s,u2,u1,k,p;
    a := n;
    u1 := 1+floor(log(n)/log(2));
    for k from 2 to u1 do
       u2 := floor(n^(1/(k-1)));
       s := add(phi(p)*floor(n/p^(k-1)),p=2..u2);
       a := a+s;
    od;
    a;
    end;
    [seq(A366471(n),n=1..100)];

Formula

a(n) = Sum_{k=1 .. 1+floor(log_2(n))} Sum_{p=2..floor(n^(1/(k-1)))} phi(p)*floor(n/p^(k-1)) where phi is the Euler phi-function A000010.

A078632 Number of geometric subsequences of [1,...,n] with integral successive-term ratio and length > 1.

Original entry on oeis.org

0, 1, 2, 5, 6, 9, 10, 15, 18, 21, 22, 28, 29, 32, 35, 43, 44, 50, 51, 57, 60, 63, 64, 73, 76, 79, 84, 90, 91, 98, 99, 109, 112, 115, 118, 129, 130, 133, 136, 145, 146, 153, 154, 160, 166, 169, 170, 183, 186, 192, 195, 201, 202, 211, 214, 223, 226, 229, 230, 242
Offset: 1

Views

Author

Robert E. Sawyer (rs.1(AT)mindspring.com)

Keywords

Comments

The number of geometric subsequences of [1,...,n] with integral successive-term ratio r and length k is floor(n/r^(k-1))(n > 0, r > 1, k > 0).

Examples

			a(2): [1,2]; a(3): [1,2],[1,3]; a(4): [1,2],[1,3],[1,4],[2,4],[1,2,4].
		

Crossrefs

Cf. A078651.
Row sums of triangle A090623.
Partial sums of A309891.

Programs

  • Maple
    g := (n, b) -> local i; add(iquo(n, b^i), i = 1..floor(log(n, b))):
    a := n -> local b; add(g(n, b), b = 2..n):
    seq(a(n), n = 1..60);  # Peter Luschny, Apr 03 2025
  • Mathematica
    Accumulate[Table[Total[IntegerExponent[n, Rest[Divisors[n]]]], {n, 100}]] (* Paolo Xausa, Aug 27 2025 *)
  • PARI
    A078632(n) = {my(s=0, k=2); while(k<=n, s+=(n - sumdigits(n, k))/(k-1); k=k+1); s} \\ Zhuorui He, Aug 26 2025

Formula

a(n) = Sum_{r > 1, j > 0} floor(n/r^j).

A365677 Number of increasing geometric progressions in {1,2,3,...,n} with rational ratio and length >= 3.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 3, 5, 5, 5, 6, 6, 6, 6, 11, 11, 13, 13, 14, 14, 14, 14, 16, 20, 20, 24, 25, 25, 25, 25, 31, 31, 31, 31, 36, 36, 36, 36, 38, 38, 38, 38, 39, 41, 41, 41, 46, 52, 56, 56, 57, 57, 61, 61, 63, 63, 63, 63, 64, 64, 64, 66, 79, 79, 79, 79, 80, 80, 80, 80, 86, 86, 86, 90, 91, 91
Offset: 1

Views

Author

Keywords

Examples

			a(9) = 5 as {1,2,...,9} contains the geometric progressions [1,2,4], [1,2,4,8], [2,4,8], [1,3,9], [4,6,9].
		

Crossrefs

Formula

a(n) = A366471(n) - n*(1 + (n-1)/2) = Sum_{k=3 .. 1+floor(log_2(n))} Sum_{p=2..floor(n^(1/(k-1)))} phi(p)*floor(n/p^(k-1)), where phi is the Euler phi-function A000010.

A365047 a(n) is the number of three-term geometric progressions, with rational ratio > 0, formed by the terms a(n-1), a(n-1-k) and a(n-1-2*k), where k >= 1 and n - 1 - 2*k >= 0.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Oct 21 2023

Keywords

Comments

The sequence is dominated by the count of three-term progressions consisting of three 0's. The 0 terms alternate between long runs on the even and odd n values, so the larger nonzero terms alternate between counting the progressions on these two subsequences, leading to two interrupted lines on the graph of the terms, along with the much lower counts of other three-term subsequences. See the attached image.

Examples

			a(3) = 1 and a(2) = a(1) = a(0) = 0 form a progression with ratio 1 separated by one term.
a(8) = 1 as a(7) = a(5) = a(3) = 1 for a progression with ratio 1 separated by two terms.
a(12) = 2 as a(11) = a(8) = a(5) = 1 form a progression with ratio 1 separated by three terms, while a(11) = a(7) = a(3) = 1 form a progression with ratio 1 separated by four terms.
a(20) = 2 as a(19) = 4, a(15) = 2, a(11) = 1 form a progression with ratio 1/2 separated by four terms, while a(19) = 4, a(12) = 2, a(5) = 1  form a progression with ratio 1/2 separated by seven terms.
a(170) = 1 as a(169) = 16, a(131) = 12, a(93) = 9 form a progression with ratio 3/4 separated by thirty-eight terms. This is the first series with a ratio that is not an integer or an integer reciprocal.
		

Crossrefs

A366907 a(n) is the number of geometric progressions with three or more terms, with rational ratio > 0, formed by the terms a(n-1), a(n-1-k), a(n-1-2*k),...,a(n-1-t*k) where k>=1, t>=2, and n-1-t*k>=0.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 2, 0, 4, 1, 0, 1, 0, 0, 2, 0, 3, 0, 3, 0, 6, 0, 7, 0, 9, 0, 13, 0, 12, 0, 15, 0, 21, 0, 20, 0, 22, 0, 30, 0, 30, 0, 31, 0, 38, 0, 39, 0, 43, 0, 47, 0, 46, 0, 53, 0, 61, 0, 57, 0, 59, 0, 69, 0, 72, 0, 72, 0, 78, 0, 79, 0, 84, 0, 91, 0, 90, 0, 96, 0, 103, 0, 98, 0, 105, 0, 116
Offset: 0

Views

Author

Scott R. Shannon, Oct 27 2023

Keywords

Comments

The sequence is dominated by the count of progressions consisting of three or more 0's. Very rarely the count of these zero-progressions forms a new progression of its own, which forms a short series of small terms and resets the subsequent count of the zero-progressions to a lower value. In the first 10^5 terms this only happens three times - at a(10) (which is not readily noticeable on the graph of the terms), a(644), and a(61434). See the attached images.

Examples

			a(3) = 1 and a(2) = a(1) = a(0) = 0 form a progression with ratio 1 separated by one term.
a(7) = 2 as a(6) = a(4) = a(2) = 0 form a three-term progression with ratio 1 separated by two terms, while a(6) = a(4) = a(2) = a(0) = 0 form a four-term progression with ratio 1 separated by two terms.
a(10) = 1 as a(9) = 4, a(7) = 2, a(5) = 1 form a three-term progression with ratio 1/2 separated by two terms.
		

Crossrefs

A381886 Triangle read by rows: T(n, k) = Sum_{j=1..floor(log[k](n))} floor(n / k^j) if k >= 2, T(n, 1) = n, T(n, 0) = 0^n.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Apr 03 2025

Keywords

Examples

			Triangle starts:
  [ 0] 1;
  [ 1] 0,  1;
  [ 2] 0,  2,  1;
  [ 3] 0,  3,  1, 1;
  [ 4] 0,  4,  3, 1, 1;
  [ 5] 0,  5,  3, 1, 1, 1;
  [ 6] 0,  6,  4, 2, 1, 1, 1;
  [ 7] 0,  7,  4, 2, 1, 1, 1, 1;
  [ 8] 0,  8,  7, 2, 2, 1, 1, 1, 1;
  [ 9] 0,  9,  7, 4, 2, 1, 1, 1, 1, 1;
  [10] 0, 10,  8, 4, 2, 2, 1, 1, 1, 1, 1;
  [11] 0, 11,  8, 4, 2, 2, 1, 1, 1, 1, 1, 1;
  [12] 0, 12, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1;
		

Crossrefs

Cf. A011371 (column 2), A054861 (column 3), A054893 (column 4), A027868 (column 5), A054895 (column 6), A054896 (column 7), A054897 (column 8), A054898 (column 9), A078651 (row sums).

Programs

  • Maple
    T := (n, b) -> local i; ifelse(b = 0, b^n, ifelse(b = 1, n, add(iquo(n, b^i), i = 1..floor(log(n, b))))): seq(seq(T(n, b), b = 0..n), n = 0..12);
    # Alternative:
    T := (n, k) -> local j; ifelse(k = 0, k^n, ifelse(k = 1, n, add(padic:-ordp(j, k), j = 1..n))): for n from 0 to 12 do seq(T(n, k), k = 0..n) od;
  • Mathematica
    T[n_, 0] := If[n == 0, 1, 0]; T[n_, 1] := n;
    T[n_, k_] := Last@Accumulate[IntegerExponent[Range[n], k]];
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // MatrixForm
    (* Alternative: *)
    T[n_, k_] := Sum[Floor[n/k^j], {j, Floor[Log[k, n]]}]; T[n_, 1] := n; T[n_, 0] := 0^n; T[0, 0] = 1; Flatten@ Table[T[n, k], {n, 0, 12}, {k, 0, n}] (* Michael De Vlieger, Apr 03 2025 *)
  • PARI
    T(n,k) = if (n==0, 1, if (n==1, k, if (k==0, 0, if (k==1, n, sum(j=1, n, valuation(j, k))))));
    row(n) = vector(n+1, k, T(n,k-1)); \\ Michel Marcus, Apr 04 2025
  • Python
    from math import log
    def T(n: int, b: int) -> int:
        return (b**n if b == 0 else n if b == 1 else
            sum(n // (b**i) for i in range(1, 1 + int(log(n, b)))))
    print([[T(n, b) for b in range(n+1)] for n in range(12)])
    
  • SageMath
    def T(n, b): return (b^n if b == 0 else n if b == 1 else sum(valuation(j, b) for j in (1..n)))
    print(flatten([[T(n, b) for b in range(n+1)] for n in srange(13)]))
    

Formula

T(n, k) = Sum_{j=1..n} valuation(j, k) for n >= 2.
Showing 1-8 of 8 results.