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-30 of 59 results. Next

A072030 Array read by antidiagonals: T(n,k) = number of steps in simple Euclidean algorithm for gcd(n,k) where n >= 1, k >= 1.

Original entry on oeis.org

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

Views

Author

Michael Somos, Jun 07 2002

Keywords

Comments

The old definition was: Triangle T(a,b) read by rows giving number of steps in simple Euclidean algorithm for gcd(a,b) (a > b >= 1). [For this, see A049834.]
For example <11,3> -> <8,3> -> <5,3> -> <3,2> -> <2,1> -> <1,1> -> <1,0> takes 6 steps.
The number of steps function can be defined inductively by T(a,b) = T(b,a), T(a,0) = 0, and T(a+b,b) = T(a,b)+1.
The simple Euclidean algorithm is the Euclidean algorithm without divisions. Given a pair of positive integers with a>=b, let = . This is iterated until a^(m)=0. Then T(a,b) is the number of steps m.
Note that row n starts at k = 1; the number of steps to compute gcd(n,0) or gcd(0,n) is not shown. - T. D. Noe, Oct 29 2007

Examples

			The array begins:
   1,  2,  3,  4,  5,  6,  7,  8,  9, 10, ...
   2,  1,  3,  2,  4,  3,  5,  4,  6,  5, ...
   3,  3,  1,  4,  4,  2,  5,  5,  3,  6, ...
   4,  2,  4,  1,  5,  3,  5,  2,  6,  4, ...
   5,  4,  4,  5,  1,  6,  5,  5,  6,  2, ...
   6,  3,  2,  3,  6,  1,  7,  4,  3,  4, ...
   7,  5,  5,  5,  5,  7,  1,  8,  6,  6, ...
   8,  4,  5,  2,  5,  4,  8,  1,  9,  5, ...
   9,  6,  3,  6,  6,  3,  6,  9,  1, 10, ...
  10,  5,  6,  4,  2,  4,  6,  5, 10,  1, ...
  ...
The first few antidiagonals are:
   1;
   2,  2;
   3,  1,  3;
   4,  3,  3,  4;
   5,  2,  1,  2,  5;
   6,  4,  4,  4,  4,  6;
   7,  3,  4,  1,  4,  3,  7;
   8,  5,  2,  5,  5,  2,  5,  8;
   9,  4,  5,  3,  1,  3,  5,  4,  9;
  10,  6,  5,  5,  6,  6,  5,  5,  6, 10;
  ...
		

Crossrefs

Antidiagonal sums are A072031.
Cf. A049834 (the lower left triangle), A003989, A050873.
See also A267177, A267178, A267181.

Programs

  • Maple
    A072030 := proc(n,k)
        option remember;
        if n < 1 or k < 1 then
            0;
        elif n = k then
            1 ;
        elif n < k then
            procname(k,n) ;
        else
            1+procname(k,n-k) ;
        end if;
    end proc:
    seq(seq(A072030(d-k,k),k=1..d-1),d=2..12) ; # R. J. Mathar, May 07 2016
    # second Maple program:
    A:= (n, k)-> add(i, i=convert(k/n, confrac)):
    seq(seq(A(n, 1+d-n), n=1..d), d=1..14);  # Alois P. Heinz, Jan 31 2023
  • Mathematica
    T[n_, k_] := T[n, k] = Which[n<1 || k<1, 0, n==k, 1, nJean-François Alcover, Nov 21 2016, adapted from PARI *)
  • PARI
    T(n, k) = if( n<1 || k<1, 0, if( n==k, 1, if( n
    				

Extensions

Definition and Comments revised by N. J. A. Sloane, Jan 14 2016

A006579 a(n) = Sum_{k=1..n-1} gcd(n,k).

Original entry on oeis.org

0, 1, 2, 4, 4, 9, 6, 12, 12, 17, 10, 28, 12, 25, 30, 32, 16, 45, 18, 52, 44, 41, 22, 76, 40, 49, 54, 76, 28, 105, 30, 80, 72, 65, 82, 132, 36, 73, 86, 140, 40, 153, 42, 124, 144, 89, 46, 192, 84, 145, 114, 148, 52, 189, 134, 204, 128, 113, 58, 300, 60, 121, 210, 192
Offset: 1

Views

Author

Keywords

Comments

This sequence for a(n) also arises in the following context. If f(x) is a monic univariate polynomial of degree d>1 over Zn (= Z/nZ, the ring of integers modulo n), and we let X be the number of distinct roots of f(x) in Zn taken over all n^d choices for f(x), then the variance Var[X] = a(n)/n and the expected value E[X] = 1. - Michael Monagan, Sep 11 2015
Conjecture: a(n) != -1 (mod n) for a composite n. - Thomas Ordowski, Jun 11 2025

Examples

			a(12) = gcd(12,1) + gcd(12,2) + ... + gcd(12,11) = 1 + 2 + 3 + 4 + 1 + 6 + 1 + 4 + 3 + 2 + 1 = 28.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Antidiagonal sums of array A003989.
Cf. A018804.

Programs

  • Maple
    a:= n-> add(igcd(n, k), k=1..n-1):
    seq(a(n), n=1..64);
  • Mathematica
    f[n_] := Sum[ GCD[n, k], {k, 1, n - 1}]; Table[ f[n], {n, 1, 60}]
    f[p_, e_] := (e*(p - 1)/p + 1)*p^e; a[n_] := Times @@ f @@@ FactorInteger[n] - n; Array[a, 100] (* Amiram Eldar, Apr 26 2023 *)
  • PARI
    A006579(n) = sum(k=1,n-1,gcd(n,k)) \\ Michael B. Porter, Feb 23 2010
    
  • Python
    from math import prod
    from sympy import factorint
    def A006579(n): return prod(p**(e-1)*((p-1)*e+p) for p, e in factorint(n).items()) - n # Chai Wah Wu, May 15 2022

Formula

a(p) = p-1 for a prime p.
a(n) = A018804(n)-n = Sum_{ d divides n } (d-1)*phi(n/d). - Vladeta Jovovic, May 04 2002
a(n+2) = Sum_{k=0..n} gcd(n-k+1, k+1) = -Sum_{k=0..4n+2} gcd(4n-k+3, k+1)*(-1)^k/4. - Paul Barry, May 03 2005
G.f.: Sum_{k>=1} phi(k) * x^(2*k) / (1 - x^k)^2. - Ilya Gutkovskiy, Feb 06 2020
a(p^k) = k(p-1)p^(k-1) for prime p. - Chai Wah Wu, May 15 2022

Extensions

More terms from Robert G. Wilson v, May 04 2002
Corrected by Ron Lalonde (ronronronlalonde(AT)hotmail.com), Oct 24 2002

A092287 a(n) = Product_{j=1..n} Product_{k=1..n} gcd(j,k).

Original entry on oeis.org

1, 1, 2, 6, 96, 480, 414720, 2903040, 5945425920, 4334215495680, 277389791723520000, 3051287708958720000, 437332621360674939863040000, 5685324077688774218219520000, 15974941971638268369709427589120000, 982608696336737613503095822614528000000000
Offset: 0

Views

Author

N. J. A. Sloane, based on a suggestion from Leroy Quet, Feb 03 2004

Keywords

Comments

Conjecture: Let p be a prime and let ordp(n,p) denote the exponent of the highest power of p that divides n. For example, ordp(48,2)=4, since 48=3*(2^4). Then we conjecture that the prime factorization of a(n) is given by the formula: ordp(a(n),p) = (floor(n/p))^2 + (floor(n/p^2))^2 + (floor(n/p^3))^2 + .... Compare this to the de Polignac-Legendre formula for the prime factorization of n!: ordp(n!,p) = floor(n/p) + floor(n/p^2) + floor(n/p^3) + .... This suggests that a(n) can be considered as generalization of n!. See A129453 for the analog for a(n) of Pascal's triangle. See A129454 for the sequence defined as a triple product of gcd(i,j,k). - Peter Bala, Apr 16 2007
The conjecture is correct. - Charles R Greathouse IV, Apr 02 2013
a(n)/a(n-1) = n, n >= 1, if and only if n is noncomposite, otherwise a(n)/a(n-1) = n * f^2, f > 1. - Daniel Forgues, Apr 07 2013
Conjecture: For a product over a rectangle, f(n,m) = Product_{j=1..n} Product_{k=1..m} gcd(j,k), a factorization similar to the one given above for the square case takes place: ordp(f(n,m),p) = floor(n/p)*floor(m/p) + floor(n/p^2)*floor(m/p^2) + .... By way of directly computing the values of f(n,m), it can be verified that the conjecture holds at least for all 1 <= m <= n <= 200. - Andrey Kaydalov, Mar 11 2019

Crossrefs

Programs

  • Magma
    [n eq 0 select 1 else (&*[(&*[GCD(j,k): k in [1..n]]): j in [1..n]]): n in [0..30]]; // G. C. Greubel, Feb 07 2024
  • Maple
    f := n->mul(mul(igcd(j,k),k=1..n),j=1..n);
  • Mathematica
    a[0] = 1; a[n_] := a[n] = n*Product[GCD[k, n], {k, 1, n-1}]^2*a[n-1]; Table[a[n], {n, 0, 15}] (* Jean-François Alcover, Apr 16 2013, after Daniel Forgues *)
  • PARI
    h(n,p)=if(nCharles R Greathouse IV, Apr 02 2013
    
  • Sage
    def A092287(n):
        R = 1
        for p in primes(n+1) :
            s = 0; r = n
            while r > 0 :
                r = r//p
                s += r*r
            R *= p^s
        return R
    [A092287(i) for i in (0..15)]  # Peter Luschny, Apr 10 2013
    

Formula

Also a(n) = Product_{k=1..n} Product_{j=1..n} lcm(1..floor(min(n/k, n/j))).
From Daniel Forgues, Apr 08 2013: (Start)
Recurrence: a(0) := 1; for n > 0: a(n) := n * (Product_{j=1..n-1} gcd(n,j))^2 * a(n-1) = n * A051190(n)^2 * a(n-1).
Formula for n >= 0: a(n) = n! * (Product_{j=1..n} Product_{k=1..j-1} gcd(j,k))^2. (End)
a(n) = n! * A224479(n)^2 (the last formula above).
a(n) = n$ * A224497(n)^4, n$ the swinging factorial A056040(n). - Peter Luschny, Apr 10 2013

Extensions

Recurrence formula corrected by Daniel Forgues, Apr 07 2013

A285721 Square array read by antidiagonals: A(n,k) = number of steps in simple Euclidean algorithm for gcd(n,k) to reach the termination test n=k, read by antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 03 2017

Keywords

Examples

			The top left 18 X 18 corner of the array:
   0, 1, 2, 3, 4, 5, 6, 7, 8,  9, 10, 11, 12, 13, 14, 15, 16, 17
   1, 0, 2, 1, 3, 2, 4, 3, 5,  4,  6,  5,  7,  6,  8,  7,  9,  8
   2, 2, 0, 3, 3, 1, 4, 4, 2,  5,  5,  3,  6,  6,  4,  7,  7,  5
   3, 1, 3, 0, 4, 2, 4, 1, 5,  3,  5,  2,  6,  4,  6,  3,  7,  5
   4, 3, 3, 4, 0, 5, 4, 4, 5,  1,  6,  5,  5,  6,  2,  7,  6,  6
   5, 2, 1, 2, 5, 0, 6, 3, 2,  3,  6,  1,  7,  4,  3,  4,  7,  2
   6, 4, 4, 4, 4, 6, 0, 7, 5,  5,  5,  5,  7,  1,  8,  6,  6,  6
   7, 3, 4, 1, 4, 3, 7, 0, 8,  4,  5,  2,  5,  4,  8,  1,  9,  5
   8, 5, 2, 5, 5, 2, 5, 8, 0,  9,  6,  3,  6,  6,  3,  6,  9,  1
   9, 4, 5, 3, 1, 3, 5, 4, 9,  0, 10,  5,  6,  4,  2,  4,  6,  5
  10, 6, 5, 5, 6, 6, 5, 5, 6, 10,  0, 11,  7,  6,  6,  7,  7,  6
  11, 5, 3, 2, 5, 1, 5, 2, 3,  5, 11,  0, 12,  6,  4,  3,  6,  2
  12, 7, 6, 6, 5, 7, 7, 5, 6,  6,  7, 12,  0, 13,  8,  7,  7,  6
  13, 6, 6, 4, 6, 4, 1, 4, 6,  4,  6,  6, 13,  0, 14,  7,  7,  5
  14, 8, 4, 6, 2, 3, 8, 8, 3,  2,  6,  4,  8, 14,  0, 15,  9,  5
  15, 7, 7, 3, 7, 4, 6, 1, 6,  4,  7,  3,  7,  7, 15,  0, 16,  8
  16, 9, 7, 7, 6, 7, 6, 9, 9,  6,  7,  6,  7,  7,  9, 16,  0, 17
  17, 8, 5, 5, 6, 2, 6, 5, 1,  5,  6,  2,  6,  5,  5,  8, 17,  0
		

Crossrefs

One less than A072030.
Row 2 & column 2: A028242 (but with starting offset 1).
Row 3 & column 3 (from zero onward) seems to be A226576.
Compare also to arrays A049834, A113881, A219158.

Programs

  • Python
    def A(n, k): return 0 if n==k else 1 + A(abs(n - k), min(n, k))
    for n in range(1, 21): print([A(n - k + 1, k) for k in range(1, n + 1)]) # Indranil Ghosh, May 03 2017
  • Scheme
    (define (A285721 n) (A285721bi (A002260 n) (A004736 n)))
    (define (A285721bi row col) (cond ((= row col) 0) ((> row col) (+ 1 (A285721bi (- row col) col))) (else (+ 1 (A285721bi row (- col row))))))
    ;; Alternatively:
    (define (A285721bi row col) (if (= row col) 0 (+ 1 (A285721bi (abs (- row col)) (min col row)))))
    ;; Another implementation, as an one-dimensional sequence:
    (definec (A285721 n) (if (zero? (A285722 n)) 0 (+ 1 (A285721 (A285722 n)))))
    

Formula

If n = k, then A(n,k) = 0, if n > k, then A(n,k) = 1 + A(n-k,k), otherwise [when n < k], A(n,k) = 1 + A(n,k-n).
Or alternatively, when n <> k, A(n,k) = 1 + A(abs(n-k),min(n,k)).
A(n,k) = A072030(n,k)-1.
As an one-dimensional sequence:
a(n) = 0 if A285722(n) = 0, otherwise a(n) = 1 + a(A285722(n)). [Here A285722 is also used as an one-dimensional sequence.]

A075173 Prime factorization of n encoded by interleaving successive prime exponents in unary to bit-positions given by columns of A075300.

Original entry on oeis.org

0, 1, 2, 5, 8, 3, 128, 21, 34, 9, 32768, 7, 2147483648, 129, 10, 85, 9223372036854775808, 35, 170141183460469231731687303715884105728, 13, 130, 32769
Offset: 1

Views

Author

Antti Karttunen, Sep 13 2002

Keywords

Comments

As in A059884, here also we store the exponent e_i of p_i (p1=2, p2=3, p3=5, ...) in the factorization of n to the bit positions given by the column i-1 of A075300 (the exponent of 2 is thus stored to bit positions 0, 2, 4, ..., exponent of 3 to 1, 5, 9, 13, ..., exponent of 5 to 3, 11, 19, 27, 35, ...), but using unary instead of binary system, i.e. we actually store 2^(e_i) - 1 in binary.
This injective mapping from N to N offers an example of the proof given in Cameron's book that any distributive lattice can be represented as a sublattice of the power-set lattice P(X) of some set X. This allows us to implement GCD (A003989) with bitwise AND (A004198) and LCM (A003990) with bitwise OR (A003986). Also, to test whether x divides y, it is enough to check that ((a(x) OR a(y)) XOR a(y)) = A003987(A003986(a(x),a(y)),a(y)) is zero.

Examples

			a(24) = 23 because 24 = 2^3 * 3^1 so we add the binary words 10101 and 10 to get 10111 in binary = 23 in decimal and a(25) = 2056 because 25 = 5^2 so we form a binary word 100000001000 = 2056 in decimal.
		

References

  • P. J. Cameron, Combinatorics: Topics, Techniques, Algorithms, Cambridge University Press, 1998, page 191. (12.3. Distributive lattices)

Crossrefs

Variant: A075175. Inverse: A075174. Cf. A059884.
A003989(x, y) = A075174(A004198(a(x), a(y))), A003990(x, y) = A075174(A003986(a(x), a(y))).

A225816 Square array A(n,k) = (k!)^n, n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 6, 4, 1, 1, 1, 24, 36, 8, 1, 1, 1, 120, 576, 216, 16, 1, 1, 1, 720, 14400, 13824, 1296, 32, 1, 1, 1, 5040, 518400, 1728000, 331776, 7776, 64, 1, 1, 1, 40320, 25401600, 373248000, 207360000, 7962624, 46656, 128, 1, 1
Offset: 0

Views

Author

Alois P. Heinz, Jul 29 2013

Keywords

Comments

A(n,k) is the determinant of the k X k matrix M = [Stirling2(n+i,j)] for 1<=i,j<=k. A(2,3) = det([1,3,1; 1,7,6; 1,15,25]) = 36.
A(n,k) is the determinant of the symmetric k X k matrix M = [sigma_n(gcd(i,j))] for 1<=i,j<=k. A(2,3) = det([1,1,1; 1,5,1; 1,1,10]) = 36.
A(n,k) is (-1)^(n*k) times the determinant of the n X n matrix M = [Stirling1(k+i,j)] for 1<=i,j<=n. A(2,3) = (-1)^(2+3) * det([-6,11; 24,-50]) = 36.
A(n,k) is the number of lattice paths from {n}^k to {0}^k using steps that decrement one component by 1 such that for each point (p_1,p_2,...,p_k) we have abs(p_i-p_j) <= 1 for 1<=i,j<=k. A(2,3) = 36:
(1,2,2)-(1,1,2) (0,1,1)-(0,0,1)
/ X \ / X \
(2,2,2)-(2,1,2) (1,2,1)-(1,1,1)-(1,0,1) (0,1,0)-(0,0,0).
\ X / \ X /
(2,2,1) (2,1,1) (1,1,0) (1,0,0)
A(n,k) is the number of set partitions of [k*(n+1)] into k blocks of size n+1 such that the elements of each block are distinct mod n+1. A(2,3) = 36: 123|456|789, 126|345|789, ..., 189|234|567, 189|246|357.

Examples

			Square array A(n,k) begins:
  1, 1,  1,    1,       1,           1, ...
  1, 1,  2,    6,      24,         120, ...
  1, 1,  4,   36,     576,       14400, ...
  1, 1,  8,  216,   13824,     1728000, ...
  1, 1, 16, 1296,  331776,   207360000, ...
  1, 1, 32, 7776, 7962624, 24883200000, ...
		

Crossrefs

Columns k=0+1, 2-4 give: A000012, A000079, A000400, A009968.
Rows n=0-4 give: A000012, A000142, A001044, A000442, A134375.
Main diagonal gives: A036740.

Programs

  • Maple
    A:= (n, k)-> k!^n:
    seq(seq(A(n,d-n), n=0..d), d=0..12);

Formula

A(n,k) = (k!)^n.
A(n,k) = k^n * A(n,k-1) for k>0, A(n,0) = 1.
A(n,k) = k! * A(n-1,k) for n>0, A(0,k) = 1.
G.f. of column k: 1/(1-k!*x).

A285722 Square array A(n,k) read by antidiagonals, A(n,n) = 0, otherwise, if n > k, A(n,k) = T(n-k,k), else A(n,k) = T(n,k-n), where T(n,k) is sequence A000027 considered as a two-dimensional table.

Original entry on oeis.org

0, 1, 1, 2, 0, 3, 4, 3, 2, 6, 7, 5, 0, 5, 10, 11, 8, 6, 4, 9, 15, 16, 12, 9, 0, 8, 14, 21, 22, 17, 13, 10, 7, 13, 20, 28, 29, 23, 18, 14, 0, 12, 19, 27, 36, 37, 30, 24, 19, 15, 11, 18, 26, 35, 45, 46, 38, 31, 25, 20, 0, 17, 25, 34, 44, 55, 56, 47, 39, 32, 26, 21, 16, 24, 33, 43, 54, 66, 67, 57, 48, 40, 33, 27, 0, 23, 32, 42, 53, 65, 78, 79, 68, 58, 49, 41, 34, 28, 22, 31, 41, 52, 64, 77, 91
Offset: 1

Views

Author

Antti Karttunen, May 03 2017

Keywords

Comments

The array is read by descending antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.

Examples

			The top left 14 X 14 corner of the array:
   0,  1,  2,  4,  7, 11, 16, 22, 29, 37, 46, 56, 67, 79
   1,  0,  3,  5,  8, 12, 17, 23, 30, 38, 47, 57, 68, 80
   3,  2,  0,  6,  9, 13, 18, 24, 31, 39, 48, 58, 69, 81
   6,  5,  4,  0, 10, 14, 19, 25, 32, 40, 49, 59, 70, 82
  10,  9,  8,  7,  0, 15, 20, 26, 33, 41, 50, 60, 71, 83
  15, 14, 13, 12, 11,  0, 21, 27, 34, 42, 51, 61, 72, 84
  21, 20, 19, 18, 17, 16,  0, 28, 35, 43, 52, 62, 73, 85
  28, 27, 26, 25, 24, 23, 22,  0, 36, 44, 53, 63, 74, 86
  36, 35, 34, 33, 32, 31, 30, 29,  0, 45, 54, 64, 75, 87
  45, 44, 43, 42, 41, 40, 39, 38, 37,  0, 55, 65, 76, 88
  55, 54, 53, 52, 51, 50, 49, 48, 47, 46,  0, 66, 77, 89
  66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56,  0, 78, 90
  78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67,  0, 91
  91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79,  0
		

Crossrefs

Transpose: A285723.
Cf. A000124 (row 1, from 1 onward), A000217 (column 1).

Programs

  • Mathematica
    A[n_, n_] = 0;
    A[n_, k_] /; k == n-1 := (k^2 - k + 2)/2;
    A[1, k_] := (k^2 - 3k + 4)/2;
    A[n_, k_] /; 1 <= k <= n-2 := A[n, k] = A[n, k+1] + 1;
    A[n_, k_] /; k > n := A[n, k] = A[n-1, k] + 1;
    Table[A[n-k+1, k], {n, 1, 14}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Nov 19 2019 *)
  • Python
    def T(n, m): return ((n + m)**2 - n - 3*m + 2)//2
    def A(n, k): return 0 if n == k else T(n - k, k) if n>k else T(n, k - n)
    for n in range(1, 21): print([A(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, May 03 2017
  • Scheme
    (define (A285722 n) (A285722bi (A002260 n) (A004736 n)))
    (define (A285722bi row col) (cond ((= row col) 0) ((> row col) (A000027bi (- row col) col)) (else (A000027bi row (- col row)))))
    (define (A000027bi row col) (* (/ 1 2) (+ (expt (+ row col) 2) (- row) (- (* 3 col)) 2)))
    

Formula

If n = k, A(n,k) = 0, if n > k, A(n,k) = T(n-k,k), otherwise [when n < k], A(n,k) = T(n,k-n), where T(n,k) is sequence A000027 considered as a two-dimensional table, that is, as a pairing function from N X N to N.

A285732 Square array A(n,k) read by antidiagonals, A(n,n) = -n, otherwise, if n > k, A(n,k) = T(n-k,k), else A(n,k) = T(n,k-n), where T(n,k) is sequence A000027 considered as a two-dimensional table.

Original entry on oeis.org

-1, 1, 1, 2, -2, 3, 4, 3, 2, 6, 7, 5, -3, 5, 10, 11, 8, 6, 4, 9, 15, 16, 12, 9, -4, 8, 14, 21, 22, 17, 13, 10, 7, 13, 20, 28, 29, 23, 18, 14, -5, 12, 19, 27, 36, 37, 30, 24, 19, 15, 11, 18, 26, 35, 45, 46, 38, 31, 25, 20, -6, 17, 25, 34, 44, 55, 56, 47, 39, 32, 26, 21, 16, 24, 33, 43, 54, 66, 67, 57, 48, 40, 33, 27, -7, 23, 32, 42, 53, 65, 78
Offset: 1

Views

Author

Antti Karttunen, May 03 2017

Keywords

Comments

The array is read by descending antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.

Examples

			The top left 14 X 14 corner of the array:
  -1,  1,  2,  4,  7, 11, 16, 22, 29,  37,  46,  56,  67,  79
   1, -2,  3,  5,  8, 12, 17, 23, 30,  38,  47,  57,  68,  80
   3,  2, -3,  6,  9, 13, 18, 24, 31,  39,  48,  58,  69,  81
   6,  5,  4, -4, 10, 14, 19, 25, 32,  40,  49,  59,  70,  82
  10,  9,  8,  7, -5, 15, 20, 26, 33,  41,  50,  60,  71,  83
  15, 14, 13, 12, 11, -6, 21, 27, 34,  42,  51,  61,  72,  84
  21, 20, 19, 18, 17, 16, -7, 28, 35,  43,  52,  62,  73,  85
  28, 27, 26, 25, 24, 23, 22, -8, 36,  44,  53,  63,  74,  86
  36, 35, 34, 33, 32, 31, 30, 29, -9,  45,  54,  64,  75,  87
  45, 44, 43, 42, 41, 40, 39, 38, 37, -10,  55,  65,  76,  88
  55, 54, 53, 52, 51, 50, 49, 48, 47,  46, -11,  66,  77,  89
  66, 65, 64, 63, 62, 61, 60, 59, 58,  57,  56, -12,  78,  90
  78, 77, 76, 75, 74, 73, 72, 71, 70,  69,  68,  67, -13,  91
  91, 90, 89, 88, 87, 86, 85, 84, 83,  82,  81,  80,  79, -14
		

Crossrefs

Transpose: A285733.
Cf. A000124 (row 1, after -1), A000217 (column 1, after -1).

Programs

  • Python
    def T(n, m): return ((n + m)**2 - n - 3*m + 2)//2
    def A(n, k): return -n if n == k else T(n - k, k) if n>k else T(n, k - n)
    for n in range(1, 21): print([A(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, May 03 2017
  • Scheme
    (define (A285732 n) (A285732bi (A002260 n) (A004736 n)))
    (define (A285732bi row col) (cond ((= row col) (- row)) ((> row col) (A000027bi (- row col) col)) (else (A000027bi row (- col row)))))
    

Formula

If n = k, A(n,k) = -n, if n > k, A(n,k) = T(n-k,k), otherwise [when n < k], A(n,k) = T(n,k-n), where T(n,k) is sequence A000027 considered as a two-dimensional table, that is, as a pairing function from N X N to N.
A(n,k) = A285722(n,k) - A286100(n,k).

A286101 Square array A(n,k) read by antidiagonals: A(n,k) = T(gcd(n,k), lcm(n,k)), where T(n,k) is sequence A000027 considered as a two-dimensional table.

Original entry on oeis.org

1, 2, 2, 4, 5, 4, 7, 16, 16, 7, 11, 12, 13, 12, 11, 16, 46, 67, 67, 46, 16, 22, 23, 106, 25, 106, 23, 22, 29, 92, 31, 191, 191, 31, 92, 29, 37, 38, 211, 80, 41, 80, 211, 38, 37, 46, 154, 277, 379, 436, 436, 379, 277, 154, 46, 56, 57, 58, 59, 596, 61, 596, 59, 58, 57, 56, 67, 232, 436, 631, 781, 862, 862, 781, 631, 436, 232, 67, 79, 80, 529, 212, 991, 302, 85, 302, 991, 212, 529, 80, 79
Offset: 1

Views

Author

Antti Karttunen, May 03 2017

Keywords

Comments

The array is read by descending antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.

Examples

			The top left 12 X 12 corner of the array:
   1,   2,   4,   7,   11,   16,   22,   29,   37,   46,   56,   67
   2,   5,  16,  12,   46,   23,   92,   38,  154,   57,  232,   80
   4,  16,  13,  67,  106,   31,  211,  277,   58,  436,  529,   94
   7,  12,  67,  25,  191,   80,  379,   59,  631,  212,  947,  109
  11,  46, 106, 191,   41,  436,  596,  781,  991,   96, 1486, 1771
  16,  23,  31,  80,  436,   61,  862,  302,  193,  467, 2146,  142
  22,  92, 211, 379,  596,  862,   85, 1541, 1954, 2416, 2927, 3487
  29,  38, 277,  59,  781,  302, 1541,  113, 2557,  822, 3829,  355
  37, 154,  58, 631,  991,  193, 1954, 2557,  145, 4006, 4852,  706
  46,  57, 436, 212,   96,  467, 2416,  822, 4006,  181, 5996, 1832
  56, 232, 529, 947, 1486, 2146, 2927, 3829, 4852, 5996,  221, 8647
  67,  80,  94, 109, 1771,  142, 3487,  355,  706, 1832, 8647,  265
		

Crossrefs

Cf. A000124 (row 1 and column 1), A001844 (main diagonal).

Programs

Formula

A(n,k) = T(gcd(n,k), lcm(n,k)), where T(n,k) is sequence A000027 considered as a two-dimensional table, that is, as a pairing function from N x N to N.
A(n,k) = A(k,n), or equivalently, a(A038722(n)) = a(n). [Array is symmetric.]

A345417 Table read by upward antidiagonals: Given m, n >= 1, write gcd(prime(m),prime(n)) as d = u*prime(m)+v*prime(n) where u, v are minimal; T(m,n) = u.

Original entry on oeis.org

0, 1, -1, 1, 0, -2, 1, -1, 2, -3, 1, 1, 0, -2, -5, 1, -1, -2, 3, 4, -6, 1, 1, 1, 0, -2, -4, -8, 1, -1, 2, 2, -3, -5, 6, -9, 1, 1, -2, -1, 0, 2, 7, -6, -11, 1, -1, -1, -2, -5, 6, 5, 4, 8, -14, 1, -1, 2, 3, 2, 0, -3, -8, -9, 10, -15, 1, 1, -1, -3, -4, -3, 4, 7, 10, 6, -10, -18
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2021

Keywords

Comments

The gcd is 1 unless m=n when it is m; v is given in A345418. Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when m=n. If we ignore the diagonal, the v table is the transpose of the u table.

Examples

			The u table (this entry) begins:
[0, -1, -2, -3, -5, -6, -8, -9, -11, -14, -15, -18, -20, -21, -23, -26]
[1, 0, 2, -2, 4, -4, 6, -6, 8, 10, -10, -12, 14, -14, 16, 18]
[1, -1, 0, 3, -2, -5, 7, 4, -9, 6, -6, 15, -8, -17, 19, -21]
[1, 1, -2, 0, -3, 2, 5, -8, 10, -4, 9, 16, 6, -6, -20, -15]
[1, -1, 1, 2, 0, 6, -3, 7, -2, 8, -14, -10, 15, 4, -17, -24]
[1, 1, 2, -1, -5, 0, 4, 3, -7, 9, 12, -17, 19, 10, -18, -4]
[1, -1, -2, -2, 2, -3, 0, 9, -4, 12, 11, -13, -12, -5, -11, 25]
[1, 1, -1, 3, -4, -2, -8, 0, -6, -3, -13, 2, 13, -9, 5, 14]
[1, -1, 2, -3, 1, 4, 3, 5, 0, -5, -4, -8, -16, 15, -2, -23]
[1, -1, -1, 1, -3, -4, -7, 2, 4, 0, 15, -14, 17, 3, 13, 11]
[1, 1, 1, -2, 5, -5, -6, 8, 3, -14, 0, 6, 4, -18, -3, 12]
[1, 1, -2, -3, 3, 6, 6, -1, 5, 11, -5, 0, 10, 7, 14, -10]
...
The v table (A345418) begins:
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[-1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1]
[-2, 2, 1, -2, 1, 2, -2, -1, 2, -1, 1, -2, 1, 2, -2, 2]
[-3, -2, 3, 1, 2, -1, -2, 3, -3, 1, -2, -3, -1, 1, 3, 2]
[-5, 4, -2, -3, 1, -5, 2, -4, 1, -3, 5, 3, -4, -1, 4, 5]
[-6, -4, -5, 2, 6, 1, -3, -2, 4, -4, -5, 6, -6, -3, 5, 1]
[-8, 6, 7, 5, -3, 4, 1, -8, 3, -7, -6, 6, 5, 2, 4, -8]
[-9, -6, 4, -8, 7, 3, 9, 1, 5, 2, 8, -1, -6, 4, -2, -5]
[-11, 8, -9, 10, -2, -7, -4, -6, 1, 4, 3, 5, 9, -8, 1, 10]
[-14, 10, 6, -4, 8, 9, 12, -3, -5, 1, -14, 11, -12, -2, -8, -6]
[-15, -10, -6, 9, -14, 12, 11, -13, -4, 15, 1, -5, -3, 13, 2, -7]
[-18, -12, 15, 16, -10, -17, -13, 2, -8, -14, 6, 1, -9, -6, -11, 7]
...
		

Crossrefs

Previous Showing 21-30 of 59 results. Next