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

A200975 Numbers on the diagonals in Ulam's spiral.

Original entry on oeis.org

1, 3, 5, 7, 9, 13, 17, 21, 25, 31, 37, 43, 49, 57, 65, 73, 81, 91, 101, 111, 121, 133, 145, 157, 169, 183, 197, 211, 225, 241, 257, 273, 289, 307, 325, 343, 361, 381, 401, 421, 441, 463, 485, 507, 529, 553, 577, 601, 625, 651, 677, 703, 729, 757, 785, 813, 841, 871, 901
Offset: 1

Views

Author

Ismael Bouya, Nov 25 2011

Keywords

Comments

All entries are odd.
From Bob Selcoe, Oct 22 2014: (Start)
The following hold:
1. a(n) = (2k + 1)^2 when n = 4k + 1, k >= 0
2. a(n) = 4*k^2 + 1 when n = 4k - 1, k > 0
3 a(n) = k^2 + k + 1 when n = 2k, k > 0.
Conjecture 1: there must be at least one prime in [a(n), a(n+1)] inclusive.
Conjecture 2: generally, when j is in [(2m-1)^2+1, (2m+1)^2] inclusive, there must be at least one prime in [j-2m-1, j] inclusive. If true, then Conjecture 1 is true; also suggests A248623, A248835 and Oppermann's conjecture (see A002620) likely are true. (End)

Examples

			The numbers between ** are in this sequence.
.
  *21*--22---23---24--*25*
    |
    |
   20   *7*---8---*9*--10
    |    |              |
    |    |              |
   19    6   *1*---2   11
    |    |         |    |
    |    |         |    |
   18   *5*---4---*3*  12
    |                   |
    |                   |
  *17*--16---15---14--*13*
		

Crossrefs

Cf. A016754, A054554, A053755, and A054569 interleaved, A002620,
Cf. A121658 (complementary)

Programs

  • Mathematica
    Sort@ Flatten@ Table[4n^2 + (2j - 4)n + 1, {j, 0, 3}, {n, 16}] (* Robert G. Wilson v, Jul 10 2014 *)
    a[n_Integer/;n>0]:=Quotient[2 n (n+2)+(-1)^n-4 Mod[n^2 (3 n+2),4,-1]+7,8] (* Todd Silvestri, Oct 25 2014 *)
  • PARI
    al(n)=local(r=vector(n),j);r[1]=1;for(k=2,n,r[k]=r[k-1]+(k+2)\4*2);r /* Franklin T. Adams-Watters, Nov 26 2011 */
  • Python
    # prints all numbers on the diagonals of a sq*sq spiral
    sq = 5
    d = 1
    while 2*d - 1 < sq:
        print(4*d*d - 4*d +1)
        print(4*d*d - 4*d +1 + 1* 2* d)
        print(4*d*d - 4*d +1 + 2* 2* d)
        print(4*d*d - 4*d +1 + 3* 2* d)
        d += 1
    print(sq*sq)
    

Formula

a(4n) = 4n^2 + 2n + 1; a(4n+1) = 4n^2 + 4n + 1; a(4n+2) = 4n^2 + 6n + 3; a(4n+3) = 4n^2 + 8n + 5. [corrected by James Mitchell, Dec 31 2017]
G.f.: -x*(1+x+x^5-x^4) / ( (1+x)*(x^2+1)*(x-1)^3 ). - R. J. Mathar, Nov 28 2011
a(n) = (2*n*(n+2)+(-1)^n-4*sin((Pi*n)/2)+7)/8 = (A249356(n)+7)/8. - Todd Silvestri, Oct 25 2014
a(n) = floor_(n*(n+2)/4) + floor_(n(mod 4)/3) + 1. - Bob Selcoe, Oct 27 2014

Extensions

Edited with more terms by Franklin T. Adams-Watters, Nov 26 2011
Showing 1-1 of 1 results.