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.

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