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.

This page as a plain text file.
%I A236347 #11 Aug 07 2025 03:03:29
%S A236347 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,
%T A236347 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,
%U A236347 7,6,5,6,17,18,6,5,6,7,8,9,10,11,16,15,9,10,11,12
%N 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.
%H A236347 David Radcliffe, <a href="/A236347/b236347.txt">Table of n, a(n) for n = 1..10000</a>
%F A236347 a(n) = abs(A002260(2*n) - A002260(n)) + A002024(2*n) - A002024(n). - _David Radcliffe_, Aug 06 2025
%e A236347 Triangle in which we find distances begins:
%e A236347 _1
%e A236347 _2  3
%e A236347 _4  5  6
%e A236347 _7  8  9 10
%e A236347 11 12 13 14 15
%e A236347 16 17 18 19 20 21
%e A236347 22 23 24 25 26 27 28
%e A236347 29 30 31 32 33 34 35 36
%e A236347 37 38 39 40 41 42 43 44 45
%o A236347 (Python)
%o A236347 import math
%o A236347 def getXY(n):
%o A236347   y = int(math.sqrt(n*2))
%o A236347   if n<=y*(y+1)//2: y-=1
%o A236347   x = n - y*(y+1)//2
%o A236347   return x, y
%o A236347 for n in range(1,88):
%o A236347   ox, oy = getXY(n)
%o A236347   nx, ny = getXY(2*n)
%o A236347   print(abs(nx-ox)+abs(ny-oy), end=', ')
%Y A236347 Cf. A002260, A002024, A232113, A236345, A236346.
%K A236347 nonn
%O A236347 1,3
%A A236347 _Alex Ratushnyak_, Jan 23 2014