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

A304586 A linear mapping a(n) = x + d*n of pairs of integers (x,d), where the pairs are enumerated by the counterclockwise square spiral (an axis-parallel number spiral) starting at 0.

Original entry on oeis.org

0, 1, 3, 3, 3, -1, -7, -7, -7, -7, 2, 13, 26, 27, 28, 29, 30, 15, -2, -21, -42, -43, -44, -45, -46, -47, -23, 3, 31, 61, 93, 95, 97, 99, 101, 103, 105, 71, 35, -3, -43, -85, -129, -131, -133, -135, -137, -139, -141, -143, -96, -47, 4, 57, 112, 169, 228, 231, 234, 237, 240, 243
Offset: 0

Views

Author

Hugo Pfoertner, May 16 2018

Keywords

Comments

The sequence is a solution to the riddle described in the comments of A304584 without the restriction of x and d to nonnegative numbers.

Examples

			This is the standard counterclockwise square spiral starting at 0. - _N. J. A. Sloane_, Oct 17 2019
d:
   3 |  36--35--34--33--32--31--30  55
     |   |                       |   |
   2 |  37  16--15--14--13--12  29  54
     |   |   |               |   |   |
   1 |  38  17   4---3---2  11  28  53
     |   |   |   |       |   |   |   |
   0 |  39  18   5   0---1  10  27  52
     |   |   |   |           |   |   |
  -1 |  40  19   6---7---8---9  26  51
     |   |   |                   |   |
  -2 |  41  20--21--22--23--24--25  50
     |   |                           |
  -3 |  42--43--44--45--46--47--48--49
     _________________________________
  x:    -3  -2  -1   0   1   2   3   4
.
a(9) = 2 + 9*(-1) = -7 because the 9th position in the spiral corresponds to x = 2 and d = -1,
a(14) = 0 + 14*2 = 28 because the 14th position in the spiral corresponds to x = 0 and d = 2,
a(25) = 3 + 25*(-2) = -47 because the 25th position in the spiral corresponds to x = 3 and d = -2.
		

Crossrefs

Programs

  • Maple
    square2pair:=proc(sq)local w,k;w:=floor(sqrt(sq));k:=floor(w/2);if modp(sq,2)=0 then return[-k,k];else return[k+1,-k];fi;end:pos2pS:=proc(n)local w,q,Q,e,E,sp;w:=floor(sqrt(n));q := w^2;Q:=(w+1)^2;e:=n-q;E:=Q-n;if eRainer Rosenthal, May 24 2018

Extensions

a(1) and a(2) corrected by Rainer Rosenthal, May 24 2018

A304585 A linear mapping a(n) = x + d*n of pairs of nonnegative integers (x,d), where the pairs are enumerated by meandering antidiagonals.

Original entry on oeis.org

0, 1, 2, 6, 5, 2, 3, 9, 17, 27, 40, 34, 26, 16, 4, 5, 20, 37, 56, 77, 100, 126, 111, 94, 75, 54, 31, 6, 7, 35, 65, 97, 131, 167, 205, 245, 288, 260, 230, 198, 164, 128, 90, 50, 8, 9, 54, 101, 150, 201, 254, 309, 366, 425, 486, 550, 505, 458, 409, 358, 305, 250, 193, 134, 73, 10, 11
Offset: 0

Views

Author

Hugo Pfoertner, May 16 2018

Keywords

Comments

The sequence is an alternative solution to the riddle described in the comments of A304584.

Examples

			  d:
  5 |  20
  4 |  10  19
  3 |   9  11  18
  2 |   3   8  12  17
  1 |   2   4   7  13  16
  0 |   0   1   5   6  14  15
    |________________________
  x:    0   1   2   3   4   5
.
a(13)= 3 + 13*1 = 16 because the 13th position in the enumeration corresponds to x=3 and d=1.
		

Crossrefs

Programs

  • Maple
    pos2pM:=proc(n) local w,k,e;w:=floor(sqrt(2*n));if w*(w+1)>2*n then k:=w-1;else k:=w;fi;e:=n-k*(k+1)/2;if modp(k,2)=1 then return [k-e,e];else return [e,k-e];fi end: WhereFlea:=proc(n) local x,d,pair; pair:=pos2pM(n);x:=pair[1];d:=pair[2];return x+d*n;end: seq(WhereFlea(n),n=0..66); # Rainer Rosenthal, May 23 2018

A304587 A linear mapping a(n) = x + d*n of pairs of integers (x,d), where the pairs are enumerated by a number spiral along antidiagonals.

Original entry on oeis.org

0, 1, 2, -1, -4, 2, 7, 14, 7, -2, -11, -22, -11, 3, 16, 31, 48, 33, 16, -3, -22, -43, -66, -45, -22, 4, 29, 56, 85, 116, 89, 60, 29, -4, -37, -72, -109, -148, -113, -76, -37, 5, 46, 89, 134, 181, 230, 187, 142, 95, 46, -5, -56, -109, -164, -221, -280, -227, -172, -115, -56, 6, 67
Offset: 0

Views

Author

Hugo Pfoertner, May 16 2018

Keywords

Comments

The sequence is an alternative solution to the riddle described in the comments of A304584 without the restriction of x and d to nonnegative numbers.

Examples

			   d:
   3 |              16  28
     |             /   \   \
   2 |          17   7  15  27
     |         /   /   \   \   \
   1 |      18   8   2   6  14  26
     |     /   /   /   \   \   \   \
   0 |  19   9   3   0---1   5  13  25
     |     \   \   \    --> --> -->
  -1 |      20  10   4  12  24
     |         \   \  /   /
  -2 |          21  11  23
     |             \   /
  -3 |              22
    __________________________________
  x:    -3  -2  -1   0   1   2   3   4
.
a(10) = -1 + 10*(-1) = -11 because the 10th position in the spiral corresponds to x = -1 and d = -1,
a(15) = 1 + 15*2 = 31 because the 15th position in the spiral corresponds to x = 1 and d = 2,
a(25) = 4 + 25*0 = 4 because the 25th position in the spiral corresponds to x = 4 and d = 0.
		

Crossrefs

Cf. A001844 (where the spiral jumps to next ring), A304584, A304585, A304586.

Programs

  • Maple
    n2left := proc(n)local w,k;return floor(sqrt((n-1)/2));end:pos2pH:=proc(n)local k,q,Q,e,E,sp;k:=n2left(n);q:=2*k^2+1;Q:=2*(k+1)^2+1;e:=n-q;E:=Q-n;if n<2 then return[n,0];fi;if e<=k then return[-k+e,-e];elif e<2*k then return[-k+e,-2*k+e];elif E<=k+1 then return[-(k+1)+E,E];else return[E-(k+1),2*(k+1)-E];fi;end:WhereFlea:=proc(n) local x,d,pair; pair:=pos2pH(n);x:=pair[1];d:=pair[2];return x+d*n;end: seq(WhereFlea(n),n=0..62);# Rainer Rosenthal, May 28 2018
  • Sage
    def a(n):
        if n<2: return n
        k = isqrt((n-1)/2)
        e = n-k*(2*k+1)-1
        x = e if ePeter Luschny, May 29 2018

Extensions

a(1) corrected by Rainer Rosenthal, May 28 2018

A305260 A linear mapping a(n) = x + y*n of pairs of nonnegative integers (x,y), where the pairs are enumerated first by radial coordinate r and in case of ties, by polar angle 0 <= phi <= Pi/2 in a polar coordinate system.

Original entry on oeis.org

0, 1, 2, 4, 2, 10, 8, 15, 18, 3, 30, 14, 37, 29, 44, 4, 64, 21, 73, 60, 44, 86, 5, 73, 99, 125, 31, 136, 61, 147, 124, 98, 163, 6, 204, 41, 217, 80, 230, 161, 204, 129, 255, 7, 308, 52, 235, 330, 198, 298, 107, 359, 163, 374, 276, 335, 8, 456, 66, 243, 424, 489, 132, 506, 390, 203, 531
Offset: 0

Views

Author

Hugo Pfoertner, Jun 15 2018

Keywords

Comments

Secondary sorting by polar angle is equivalent to secondary sorting by y.
The sequence is an alternative solution to the riddle described in the comments of A304584.

Examples

			   y:
     |
   8 |  57  61  63  66  70
     |
   7 |  44  47  51  53  60  68
     |
   6 |  34  36  38  42  49  55  64
     |
   5 |  25  27  29  32  40  46  54  67
     |
   4 |  16  18  21  24  30  39  48  59  69
     |
   3 |  10  12  14  19  23  31  41  52  65
     |
   2 |   5   7   8  13  20  28  37  50  62
     |
   1 |   2   3   6  11  17  26  35  45  58
     |
   0 |   0   1   4   9  15  22  33  43  56  71
       _______________________________________
  x:     0   1   2   3   4   5   6   7   8   9
.
a(5) = x(5) + 5*y(5) = 0 + 5*2 = 10,
a(14) = x(14) + 14*y(14) = 2 + 14*3 = 44,
a(20) = x(20) + 20*y(20) = 4 + 20*2 = 44.
		

Crossrefs

Programs

  • PARI
    n=-1;for(r2=0,81,for(y=0,round(sqrt(r2)),x2=r2-y^2;if(issquare(x2),print1(round(sqrt(x2))+y*(n++),", "))))
Showing 1-4 of 4 results.