login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 1

%I #6 Jan 27 2014 12:58:14

%S 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 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 7,6,5,6,17,18,6,5,6,7,8,9,10,11,16,15,9,10,11,12

%N 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.

%e Triangle in which we find distances begins:

%e _1

%e _2 3

%e _4 5 6

%e _7 8 9 10

%e 11 12 13 14 15

%e 16 17 18 19 20 21

%e 22 23 24 25 26 27 28

%e 29 30 31 32 33 34 35 36

%e 37 38 39 40 41 42 43 44 45

%o (Python)

%o import math

%o def getXY(n):

%o y = int(math.sqrt(n*2))

%o if n<=y*(y+1)/2: y-=1

%o x = n - y*(y+1)/2

%o return x, y

%o for n in range(1,88):

%o ox, oy = getXY(n)

%o nx, ny = getXY(2*n)

%o print str(abs(nx-ox)+abs(ny-oy))+',',

%Y Cf. A232113, A236345, A236346.

%K nonn

%O 1,3

%A _Alex Ratushnyak_, Jan 23 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 04:56 EDT 2024. Contains 371767 sequences. (Running on oeis4.)