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

A236346 Manhattan distances between n^2 and (n+1)^2 in a left-aligned triangle with next M natural numbers in row M: 1, 2 3, 4 5 6, 7 8 9 10, etc.

Original entry on oeis.org

2, 3, 4, 4, 5, 6, 6, 8, 7, 10, 8, 9, 12, 10, 14, 11, 12, 16, 13, 18, 14, 20, 15, 16, 22, 17, 24, 18, 19, 26, 20, 28, 21, 22, 30, 23, 32, 24, 34, 25, 26, 36, 27, 38, 28, 29, 40, 30, 42, 31, 44, 32, 33, 46, 34, 48, 35, 36, 50, 37, 52, 38, 54, 39, 40, 56, 41, 58
Offset: 1

Views

Author

Alex Ratushnyak, Jan 23 2014

Keywords

Comments

Triangle in which we find distances begins:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
Subsequence of terms such that a(m)>=a(m-1) and a(m)>=a(m+1) seems to be A005843 (even numbers) except first two terms, and if such a(m) are removed, the remainder seems to be A000027 (natural numbers) except 1:
2, 3, *4*, 4, 5, *6*, 6, *8*, 7, *10*, 8, 9, *12*, 10, *14*, 11, 12, *16*, 13, *18*, 14, *20*, 15, ...

Crossrefs

Programs

  • Python
    import math
    def getXY(n):
      y = int(math.sqrt(n*2))
      if n<=y*(y+1)//2: y-=1
      x = n - y*(y+1)//2
      return x, y
    for n in range(1, 77):
      ox, oy = getXY(n*n)
      nx, ny = getXY((n+1)**2)
      print(abs(nx-ox)+abs(ny-oy), end=', ')

Formula

a(n) = A214848(n) + |A057049(n+1) - A057049(n)|. - David Radcliffe, Aug 06 2025

A236347 Manhattan distances between n and 2*n in a left-aligned triangle with next M natural numbers in row M: 1, 2 3, 4 5 6, 7 8 9 10, etc.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Jan 23 2014

Keywords

Examples

			Triangle in which we find distances begins:
_1
_2  3
_4  5  6
_7  8  9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
		

Crossrefs

Programs

  • Python
    import math
    def getXY(n):
      y = int(math.sqrt(n*2))
      if n<=y*(y+1)//2: y-=1
      x = n - y*(y+1)//2
      return x, y
    for n in range(1,88):
      ox, oy = getXY(n)
      nx, ny = getXY(2*n)
      print(abs(nx-ox)+abs(ny-oy), end=', ')

Formula

a(n) = abs(A002260(2*n) - A002260(n)) + A002024(2*n) - A002024(n). - David Radcliffe, Aug 06 2025

A236459 Regular triangle: T(n, k) Manhattan distance between n and k in a left-aligned triangle with next M natural numbers in row M.

Original entry on oeis.org

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

Views

Author

Michel Marcus, Jan 26 2014

Keywords

Comments

First column is A051162. Right diagonal is all zeros.

Examples

			Triangle where distances are measured begins:
1
2 3
4 5 6
7 8 9 10
Distance between 1 and 1 is 0, hence T(1, 1) = 0.
Distance between 2 and 1 is 1, and between 2 and 2 is 0. Hence second row of this triangle is 1, 0.
Triangle starts:
0;
1, 0;
2, 1, 0;
2, 1, 2, 0;
3, 2, 1, 1, 0;
		

Crossrefs

Cf. A236345.

Programs

  • PARI
    getxy(n) = {y = sqrtint(2*n); if (n<=y*(y+1)/2, y--); x = n - y*(y+1)/2; [x, y];}
    trg(nn) = {i= 1; for (n = 1, nn, v = getxy(n); for (k = 1, n, nv = getxy(k); print1(abs(nv[1]-v[1])+abs(nv[2]-v[2]), ", ");); print(););}
Showing 1-3 of 3 results.