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

A048158 Triangular array T read by rows: T(n,k) = n mod k, for k=1,2,...,n, n=1,2,...

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Also, rectangular array read by antidiagonals: a(n, k) = n mod k, n >= 0, k >= 1. Cf. A051126, A051127, A051777. - David Wasserman, Oct 01 2008

Examples

			Triangle begins
  0;
  0  0;
  0  1  0;
  0  0  1  0;
  0  1  2  1  0;
  0  0  0  2  1  0;
  0  1  1  3  2  1  0;
  0  0  2  0  3  2  1  0;
  0  1  0  1  4  3  2  1  0;
  0  0  1  2  0  4  3  2  1  0;
  0  1  2  3  1  5  4  3  2  1  0;
  0  0  0  0  2  0  5  4  3  2  1  0;
  ...
From _Omar E. Pol_, Feb 21 2014: (Start)
Illustration of the 12th row of triangle:
-----------------------------------
.      k: 1 2 3 4 5 6 7 8 9 10..12
-----------------------------------
.         _ _ _ _ _ _ _ _ _ _ _ _
.        |_| | | | | | | | | | | |
.        |_|_| | | | | | | | | | |
.        |_| |_| | | | | | | | | |
.        |_|_| |_| | | | | | | | |
.        |_| | | |_| | | | | | | |
.        |_|_|_| | |_| | | | | | |
.        |_| | | | | |_| | | | | |
.        |_|_| |_| | |*|_| | | | |
.        |_| |_| | | |* *|_| | | |
.        |_|_| | |_| |* * *|_| | |
.        |_| | | |*| |* * * *|_| |
.        |_|_|_|_|*|_|* * * * *|_|
.
Row 12 is 0 0 0 0 2 0 5 4 3 2 1 0
(End)
		

Crossrefs

Row sums are given by A004125.
Cf. A002260.

Programs

  • Haskell
    a048158 = mod
    a048158_row n = a048158_tabl !! (n-1)
    a048158_tabl = zipWith (map . mod) [1..] a002260_tabl
    -- Reinhard Zumkeller, Apr 29 2015, Jan 20 2014 (fixed), Aug 13 2013
    
  • Maple
    T:= (n, k)-> modp(n, k):
    seq(seq(T(n, k), k=1..n), n=1..20); # Alois P. Heinz, Apr 04 2012
  • Mathematica
    Flatten[Table[Mod[n, Range[n]], {n, 15}]]
  • Python
    def A048158_T(n,k): return n%k # Chai Wah Wu, May 13 2024

Formula

A051731(n,k) = A000007(T(n,k)). - Reinhard Zumkeller, Nov 01 2009
T(n,k) = n - k*A010766(n,k). - Mats Granvik, Gary W. Adamson, Feb 20 2010
G.f. for the k-th column: x^(k+1)*Sum_{i=0..k-2} (i + 1)*x^i/(1 - x^k). - Stefano Spezia, May 08 2024

Extensions

More terms from David Wasserman, Oct 01 2008

A051127 Table T(n,k) = k mod n read by antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Note that the upper right half of this sequence when formatted as a square array is essentially the same as this whole sequence when formatted as an upper right triangle. Sums of antidiagonals are A004125. - Henry Bottomley, Jun 22 2001

Examples

			0  0  0  0  0  0  0  0  0  0 ...
1  0  1  0  1  0  1  0  1  0 ...
1  2  0  1  2  0  1  2  0  1 ...
1  2  3  0  1  2  3  0  1  2 ...
1  2  3  4  0  1  2  3  4  0 ...
1  2  3  4  5  0  1  2  3  4 ...
1  2  3  4  5  6  0  1  2  3 ...
1  2  3  4  5  6  7  0  1  2 ...
1  2  3  4  5  6  7  8  0  1 ...
1  2  3  4  5  6  7  8  9  0 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
		

Crossrefs

Transpose of A051126.

Programs

  • Mathematica
    T[n_, m_] = Mod[n - m + 1, m + 1]; Table[Table[T[n, m], {m, 0, n}], {n, 0, 10}]; Flatten[%] (* Roger L. Bagula, Sep 04 2008 *)
  • PARI
    T(n, k)=k%n \\ Charles R Greathouse IV, Feb 09 2017

Formula

As a linear array, the sequence is a(n) = A004736(n) mod A002260(n) or a(n) = ((t*t+3*t+4)/2-n) mod (n-(t*(t+1)/2)), where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 17 2012
G.f. for the n-th row: y*Sum_{i=0..n-2} (i + 1)*y^i/(1 - y^n). - Stefano Spezia, May 08 2024

Extensions

More terms from James Sellers, Dec 11 1999

A062347 a(n) = (product of first n primes) modulo prime(n+1).

Original entry on oeis.org

1, 2, 1, 2, 1, 9, 8, 18, 15, 17, 19, 11, 6, 26, 35, 27, 15, 55, 30, 24, 28, 4, 47, 56, 28, 28, 75, 25, 105, 30, 9, 52, 111, 89, 46, 132, 53, 97, 104, 106, 42, 94, 158, 184, 155, 5, 6, 45, 87, 78, 86, 26, 120, 33, 242, 66, 86, 2, 214, 2, 198, 127, 14, 112, 7, 141, 77, 309
Offset: 0

Views

Author

Henry Bottomley, Jul 06 2001

Keywords

Examples

			a(4)=1 since 2*3*5*7 = 210 = 19*11 + 1.
		

Crossrefs

Programs

  • Mathematica
    Mod[ #[ [ 1 ] ], #[ [ 2 ] ] ]&/@ Transpose[ {FoldList[ Times, 1, Prime[ Range[ 70 ] ] ], Prime[ Range[ 71 ] ]} ]
    Join[{1},Module[{nn=70,prs},prs=Prime[Range[nn]];Table[Mod[Fold[Times,Take[prs,n-1]],prs[[n]]],{n,2,nn}]]] (* Harvey P. Dale, Jun 30 2024 *)
  • PARI
    { n=-1; f=1; forprime (p=2, prime(1001), write("b062347.txt", n++, " ", f%p); f*=p ) } \\ Harry J. Smith, Aug 05 2009
    
  • Python
    from sympy import sieve, primorial
    print([1] + [primorial(k) % sieve[k+1] for k in range(1, 71)])
    # Karl-Heinz Hofmann, Jan 26 2022

Formula

a(n) = A051126(A002110(n), A000040(n+1)).

A051778 Triangle read by rows, where row (n) = n mod (n-1), n mod (n-2), n mod (n-3), ...n mod 2.

Original entry on oeis.org

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

Views

Author

Asher Auel, Dec 09 1999

Keywords

Comments

Central terms: a(2*n+1,n) = n for n > 0. - Reinhard Zumkeller, Dec 03 2014
Deleting column 1 of the array at A051126 gives the array A051778 in square format (see Example). - Clark Kimberling, Feb 04 2016

Examples

			row (7) = 7 mod 6, 7 mod 5, 7 mod 4, 7 mod 3, 7 mod 2 = 1, 2, 3, 1, 1.
1;
1  0 ;
1  2  1 ;
1  2  0  0 ;
1  2  3  1  1 ;
1  2  3  0  2  0 ;
1  2  3  4  1  0  1 ;
1  2  3  4  0  2  1  0 ;
1  2  3  4  5  1  3  2  1 ;
1  2  3  4  5  0  2  0  0  0 ;
1  2  3  4  5  6  1  3  1  1  1 ;
Northwest corner of square array:
1 1 1 1 1 1 1 1 1 1 1
0 2 2 2 2 2 2 2 2 2 2
1 0 3 3 3 3 3 3 3 3 3
0 1 0 4 4 4 4 4 4 4 4
1 2 1 0 5 5 5 5 5 5 5
0 0 2 1 0 6 6 6 6 6 6
1 1 3 2 1 0 7 7 7 7 7
- _Clark Kimberling_, Feb 04 2016
		

Crossrefs

Cf. A004125 (row sums), A000027 (central terms), A049820 (number of nonzeros per row), A032741 (number of ones per row), A070824 (number of zeros per row).

Programs

  • Haskell
    a051778 n k = a051778_tabl !! (n-3) !! (k-1)
    a051778_row n = a051778_tabl !! (n-3)
    a051778_tabl = map (\xs -> map (mod (head xs + 1)) xs) $
                       iterate (\xs -> (head xs + 1) : xs) [2]
    -- Reinhard Zumkeller, Dec 03 2014
  • Mathematica
    Flatten[Table[Mod[n,i],{n,3,20},{i,n-1,2,-1}]] (* Harvey P. Dale, Sep 09 2012 *)
    TableForm[Table[Mod[n, k], {n, 1, 12}, {k, 2, 12}]] (* square *)
    (* Clark Kimberling, Feb 04 2016 *)

A372523 Triangle read by rows: T(n, k) is equal to n/k if k | n, else to the concatenation of A003988(n, k) = floor(n/k) and A051127(k, n) = n mod k.

Original entry on oeis.org

1, 2, 1, 3, 11, 1, 4, 2, 11, 1, 5, 21, 12, 11, 1, 6, 3, 2, 12, 11, 1, 7, 31, 21, 13, 12, 11, 1, 8, 4, 22, 2, 13, 12, 11, 1, 9, 41, 3, 21, 14, 13, 12, 11, 1, 10, 5, 31, 22, 2, 14, 13, 12, 11, 1, 11, 51, 32, 23, 21, 15, 14, 13, 12, 11, 1, 12, 6, 4, 3, 22, 2, 15, 14, 13, 12, 11, 1
Offset: 1

Views

Author

Stefano Spezia, May 04 2024

Keywords

Examples

			The triangle begins:
  1;
  2,  1;
  3, 11,  1;
  4,  2, 11,  1;
  5, 21, 12, 11,  1;
  6,  3,  2, 12, 11,  1;
  7, 31, 21, 13, 12, 11, 1;
  ...
		

Crossrefs

Cf. A000012 (right diagonal), A000027 (1st column).

Programs

  • Mathematica
    T[n_,k_]:=If[Divisible[n,k],n/k,FromDigits[Join[IntegerDigits[Floor[n/k]],IntegerDigits[Mod[n,k]]]]]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_,k_]:=Floor[n/k]10^IntegerLength[Mod[n,k]]+Mod[n,k]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_, k_]:=SeriesCoefficient[x^k(1+Sum[(i + 10^(1+Floor[Log10[Mod[n,k]]]))*x^i, {i, k-1}] - Sum[i*x^(k+i), {i, k-1}])/(1-x^k)^2, {x, 0, n}]; Table[T[n, k], {n, 12}, {k, n}]//Flatten

Formula

T(n, k) = floor(n/k)*10^(1+floor(log10(n mod k))) + (n mod k) if n is not divisible by k.
T(n, n) = 1.
T(n, 1) = n.
T(n, k) = 2*T(n-k, k) - T(n-2*k, k) for n >= 3*k.
T(n, k) = [x^n] x^k*(1 + (Sum_{i=1..k-1} (i + 10^(1+floor(log10(n mod k))))*x^i) - (Sum_{i=1..k-1} i*x^(k+i)))/(1 - x^k)^2.

A100990 a(n) = n^21 mod 100.

Original entry on oeis.org

0, 1, 52, 3, 4, 25, 56, 7, 8, 9, 0, 11, 12, 13, 64, 75, 16, 17, 68, 19, 0, 21, 72, 23, 24, 25, 76, 27, 28, 29, 0, 31, 32, 33, 84, 75, 36, 37, 88, 39, 0, 41, 92, 43, 44, 25, 96, 47, 48, 49, 0, 51, 52, 53, 4, 75, 56, 57, 8, 59, 0, 61, 12, 63, 64, 25, 16, 67, 68, 69, 0, 71, 72, 73, 24
Offset: 0

Views

Author

Henry Bottomley, Nov 25 2004

Keywords

Comments

Also n^(20k+1) mod 100 for any positive integer k.
There are 63 numbers (A075821) where the final two digits of n^21, n^41, n^61, etc. are equal to n.
Period 100.

Examples

			a(11) = 11 since 11^21 = 7400249944258160101211 and the final two digits are 11.
		

Crossrefs

Programs

Formula

a(n) = A051126(A010809(n), 100) = a(n-100).

A309176 a(n) = n^2 * (n + 1)/2 - Sum_{k=1..n} sigma_2(k).

Original entry on oeis.org

0, 0, 2, 3, 12, 13, 33, 40, 66, 81, 135, 135, 212, 249, 319, 354, 489, 511, 681, 725, 876, 981, 1233, 1235, 1509, 1660, 1920, 2032, 2437, 2472, 2936, 3091, 3488, 3755, 4275, 4290, 4955, 5292, 5854, 6024, 6843, 6968, 7870, 8190, 8839, 9340, 10420, 10442, 11568, 12038, 13014, 13474, 14851, 15098, 16436
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 15 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Table[n^2 (n + 1)/2 - Sum[DivisorSigma[2, k], {k, 1, n}], {n, 1, 55}]
    nmax = 55; CoefficientList[Series[x (1 + 2 x)/(1 - x)^4 - 1/(1 - x) Sum[k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
    Table[Sum[Mod[n, k] k, {k, 1, n}], {n, 1, 55}]
  • PARI
    a(n) = n^2*(n+1)/2 - sum(k=1, n, sigma(k, 2)); \\ Michel Marcus, Sep 18 2021
    
  • Python
    from math import isqrt
    def A309176(n): return (n**2*(n+1)>>1)+((s:=isqrt(n))**2*(s+1)*(2*s+1)-sum((q:=n//k)*(6*k**2+q*(2*q+3)+1) for k in range(1,s+1)))//6 # Chai Wah Wu, Oct 21 2023

Formula

G.f.: x * (1 + 2*x)/(1 - x)^4 - (1/(1 - x)) * Sum_{k>=1} k^2 * x^k/(1 - x^k).
a(n) = Sum_{k=1..n} (n mod k) * k.
a(n) = A002411(n) - A064602(n).

A329970 a(n) = (-1)^(n + 1) * n * ceiling(n/2) + Sum_{k=1..n} (-1)^k * k^2 * floor(n/k).

Original entry on oeis.org

0, 0, -2, 3, 0, -3, -7, 16, 2, -15, -21, 31, 24, -15, -57, 34, 25, -17, -27, 77, 8, -99, -111, 155, 117, -36, -140, 40, 25, -80, -96, 259, 112, -157, -249, 202, 183, -156, -354, 224, 203, -40, -62, 342, -21, -524, -548, 562, 488, -34, -358, 194, 167, -262
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 26 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Table[(-1)^(n + 1) n Ceiling[n/2] + Sum[(-1)^k k^2 Floor[n/k], {k, 1, n}], {n, 1, 54}]
    nmax = 54; CoefficientList[Series[x (1 - x + 2 x^2)/((1 - x)^2 (1 + x)^3) + 1/(1 - x) Sum[(-1)^k k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
    Table[Sum[(-1)^(k + 1) Mod[n, k] k, {k, 1, n}], {n, 1, 54}]
  • PARI
    a(n) = (-1)^(n + 1)*n*ceil(n/2) + sum(k=1, n, (-1)^k * k^2 * (n\k)); \\ Michel Marcus, Sep 20 2021

Formula

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

A070705 LCM of first n prime powers modulo next prime power.

Original entry on oeis.org

2, 2, 2, 4, 4, 3, 1, 4, 8, 5, 14, 15, 5, 18, 1, 20, 16, 2, 15, 15, 8, 21, 29, 21, 16, 32, 29, 23, 22, 30, 54, 71, 37, 7, 37, 43, 45, 30, 36, 77, 100, 72, 64, 7, 56, 33, 42, 54, 132, 18, 90, 156, 91, 29, 86, 149, 139, 111, 112, 96, 62, 5, 204, 103, 41, 197, 81, 218, 128, 238, 58
Offset: 1

Views

Author

Lekraj Beedassy, May 15 2002

Keywords

Examples

			The case n=7 implies a(7) = A051451(7) (mod A000961(8)) = lcm(2,3,4,5,7,8,9) (mod 11) = 2520 (mod 11) = 1.
		

Crossrefs

Formula

a(n) = A051451(n) (mod A000961(n+1)) = A051126(A051451(n), A000961(n-1)).

Extensions

More terms from Don Reble, May 16 2002
Showing 1-9 of 9 results.