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

A049765 Triangular array T, read by rows: T(n,k) = (k mod n) + (n mod k), for k = 1..n and n >= 1.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Triangle T(n,k) (with rows n >= 1 and columns k >= 1) begins as follows:
  0;
  1, 0;
  1, 3, 0;
  1, 2, 4, 0;
  1, 3, 5, 5, 0;
  1, 2, 3, 6, 6,  0;
  1, 3, 4, 7, 7,  7,  0;
  1, 2, 5, 4, 8,  8,  8,  0;
  1, 3, 3, 5, 9,  9,  9,  9,  0;
  1, 2, 4, 6, 5, 10, 10, 10, 10, 0;
  ...
		

Crossrefs

Row sums are in A049766.

Programs

  • GAP
    Flat(List([1..15], n-> List([1..n], k-> (k mod n) + (n mod k) ))); # G. C. Greubel, Dec 13 2019
  • Magma
    [[(k mod n) + (n mod k): k in [1..n]]: n in [1..15]]; // G. C. Greubel, Dec 13 2019
    
  • Maple
    seq(seq( `mod`(k, n) + `mod`(n, k), k = 1..n), n = 1..15); # G. C. Greubel, Dec 13 2019
  • Mathematica
    Table[Mod[k,n] + Mod[n,k], {n,15}, {k,n}]//Flatten (* G. C. Greubel, Dec 13 2019 *)
  • PARI
    T(n,k) = k%n + n%k;
    for(n=1,15, for(k=1,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Dec 13 2019
    
  • Sage
    [[(k%n) + (n%k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 13 2019
    

A367379 a(n) = Sum_{j=1..n} Sum_{i=1..n} (j mod i).

Original entry on oeis.org

0, 1, 5, 12, 26, 44, 73, 109, 157, 215, 292, 375, 481, 603, 744, 900, 1087, 1287, 1522, 1773, 2053, 2361, 2712, 3073, 3476, 3913, 4389, 4891, 5448, 6021, 6653, 7316, 8028, 8786, 9599, 10427, 11326, 12277, 13287, 14325, 15442, 16587, 17815, 19089, 20418, 21811
Offset: 1

Views

Author

DarĂ­o Clavijo, Nov 15 2023

Keywords

Comments

Partial sums of A049766.

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    S:= [seq(NumberTheory:-SumOfDivisors(i,1),i=1..N+1)]:
    SS:= ListTools:-PartialSums(S):
    S2:= [seq(i*S[i],i=1..N+1)]:
    SS2:= ListTools:-PartialSums(S2):
    f:= n -> 1/2*n^2*(n+1) - (n+1)*SS[n+1]+SS2[n+1]:
    map(f, [$1..N]); # Robert Israel, Dec 20 2023
  • Mathematica
    a[n_]:=n^2(n+1)/2-Sum[DivisorSigma[1,i](n-i+1),{i,n+1}]; Array[a,47,0] (* Stefano Spezia, Nov 17 2023 *)
  • PARI
    a(n) = sum(j=1, n, sum(i=1, n, j % i)); \\ Michel Marcus, Nov 16 2023
  • Python
    from sympy import divisor_sigma
    A002411 = lambda n: ((n*n)*(n+1))>>1
    A175254 = lambda n: sum(divisor_sigma(i) * (n-i+1) for i in range(1,n+1))
    a = lambda n: A002411(n) - A175254(n)
    print([a(n) for n in range(1, 53)])
    
  • Python
    from math import isqrt
    def A367379(n): return (n**2*(n+1)>>1)-(((s:=isqrt(n))**2*(s+1)*((s+1)*(2*s+1)-6*(n+1))>>1) + sum((q:=n//k)*(-k*(q+1)*(3*k+2*q+1)+3*(n+1)*(2*k+q+1)) for k in range(1,s+1)))//6 # Chai Wah Wu, Dec 20 2023
    

Formula

a(n) = A072481(n) + A000292(n-1).
a(n) = A002411(n) - A175254(n).
Showing 1-2 of 2 results.