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 11-13 of 13 results.

A214870 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places counterclockwise. T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 10, 9, 8, 13, 17, 16, 6, 14, 21, 26, 25, 11, 12, 22, 31, 37, 36, 18, 15, 20, 32, 43, 50, 49, 27, 24, 23, 30, 44, 57, 65, 64, 38, 35, 19, 33, 42, 58, 73, 82, 81, 51, 48, 28, 29, 45, 56, 74, 91, 101, 100, 66, 63, 39, 34, 41, 59, 72, 92, 111
Offset: 1

Views

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1).
Enumeration table T(n,k) layer by layer. The order of the list:
T(1,1)=1;
T(1,2), T(2,1), T(2,2);
. . .
T(1,n), T(3,n), ... T(n,3), T(n,1); T(n,2), T(n,4), ... T(4,n), T(2,n);
. . .

Examples

			The start of the sequence as table:
   1   2   5  10  17  26 ...
   3   4   9  16  25  36 ...
   7   8   6  11  18  27 ...
  13  14  12  15  24  35 ...
  21  22  20  23  19  28 ...
  31  32  30  33  29  34 ...
  ...
The start of the sequence as triangle array read by rows:
   1;
   2,  3;
   5,  4,  7;
  10,  9,  8, 13;
  17, 16,  6, 14, 21;
  26, 25, 11, 12, 22, 31;
  ...
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    if i > j:
       result=i*i-i+(j%2)*(2-(j+1)/2)+((j+1)%2)*(j/2+1)
    else:
       result=j*j-2*(i%2)*j + (i%2)*((i+1)/2+1) + ((i+1)%2)*(-i/2+1)

Formula

As table
T(n,k) = k*k-2*(n mod 2)*k+(n mod 2)*((n+1)/2+1)+((n+1) mod 2)*(-n/2+1), if n<=k;
T(n,k) = n*n-n+(k mod 2)*(2-(k+1)/2)+((k+1) mod 2)*(k/2+1), if n>k.
As linear sequence
a(n) = j*j-2*(i mod 2)*j+(i mod 2)*((i+1)/2+1)+((i+1) mod 2)*(-i/2+1), if i<=j;
a(n) = i*i-i+(j mod 2)*(2-(j+1)/2)+((j+1) mod 2)*(j/2+1), if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A370759 Numbers expressible in the form k*m + 2*(k+m) - 1, for positive k and m.

Original entry on oeis.org

4, 7, 10, 11, 13, 15, 16, 19, 20, 22, 23, 25, 27, 28, 30, 31, 34, 35, 37, 39, 40, 43, 44, 45, 46, 47, 49, 50, 51, 52, 55, 58, 59, 60, 61, 63, 64, 65, 67, 70, 71, 72, 73, 75, 76, 79, 80, 82, 83, 85, 86, 87, 88, 90, 91, 93, 94, 95, 97, 99, 100, 103, 105, 106, 107, 109, 110, 111, 112
Offset: 1

Views

Author

Nicolay Avilov, Mar 01 2024

Keywords

Comments

All such numbers are answers to the question: How many plane regions result from partitioning by two sets of straight lines, such that:
Each of the k straight lines of the first bundle passes though a single point A, and intersects each of the m straight lines of the second bundle each of which passes through a different point B. There are no straight lines belonging to both bundles, i.e. the line AB is not involved.
Because k*m+2*(k+m)-1 = (k+2)*(m+2)-5, and k and m are both positive, a(n) = A264828(n+2) - 5. - Kevin Ryde, Mar 26 2024

Examples

			4 is a term: if each bundle consists of one straight line, the plane is divided into 4 regions.
7 is a term: if the first bundle consists of one line and the second consists of two lines, the plane is divided into 7 regions.
These and other examples are illustrated in the linked figures.
		

Crossrefs

Cf. A264828, A028875 (case when k=m).

Programs

  • PARI
    print(Vec(setbinop((k,m)->k*m + 2*(k + m) - 1, [1..112]), 69)) \\ Michel Marcus, Mar 02 2024
    
  • Python
    maxval = 112
    av = [[k*m+2*k+2*m-1 for k in range(1,maxval)] for m in range(1,maxval)]
    flat = [n for row in av for n in row]
    uniq = list(set(flat))
    a370759 = list(filter(lambda x: x<=maxval, uniq))
    print(a370759)
    # Robert Munafo, Mar 25 2024
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A370759_gen(startvalue=4): # generator of terms >= startvalue
        return filter(lambda n:not (isprime(n+5) or (n&1 and isprime((n>>1)+3))),count(max(startvalue,4)))
    A370759_list = list(islice(A370759_gen(),20)) # Chai Wah Wu, Mar 26 2024

Formula

If there are k straight lines in the first bundle and m straight lines in the second bundle, then we get k*m + 2*(k + m) - 1 regions.

A386206 Triangle read by rows: T(n,k) = n^2 - k, with 0 <= k <= n.

Original entry on oeis.org

0, 1, 0, 4, 3, 2, 9, 8, 7, 6, 16, 15, 14, 13, 12, 25, 24, 23, 22, 21, 20, 36, 35, 34, 33, 32, 31, 30, 49, 48, 47, 46, 45, 44, 43, 42, 64, 63, 62, 61, 60, 59, 58, 57, 56, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90
Offset: 0

Views

Author

Stefano Spezia, Jul 15 2025

Keywords

Examples

			The triangle begins as:
   0;
   1,  0;
   4,  3,  2;
   9,  8,  7,  6;
  16, 15, 14, 13, 12;
  25, 24, 23, 22, 21, 20;
  36, 35, 34, 33, 32, 31, 30;
  49, 48, 47, 46, 45, 44, 43, 42;
  64, 63, 62, 61, 60, 59, 58, 57, 56;
  ...
		

Crossrefs

Cf. A000290 (k=0), A002414 (row sums), A005563, A008865, A028347 (k=4), A028872 (k=3), A028875 (k=5), A279019 (diagonal).

Programs

  • Magma
    [[n^2-k: k in [0..n]]: n in [0..9]]; // Vincenzo Librandi, Jul 17 2025
  • Mathematica
    T[n_,k_]:=n^2-k; Table[T[n,k],{n,0,10},{k,0,n}]//Flatten

Formula

G.f.: x*(1 + x + 2*x*y^2 + 5*x^3*y^2 - x^2*y*(4 + 5*y))/((1 - x)^3*(1 - x*y)^3).
T(n,1) = A005563(n-1) for n > 0.
T(n,2) = A008865(n) for n > 1.
Previous Showing 11-13 of 13 results.