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.

A200975 Numbers on the diagonals in Ulam's spiral.

This page as a plain text file.
%I A200975 #84 Jul 25 2021 13:55:19
%S A200975 1,3,5,7,9,13,17,21,25,31,37,43,49,57,65,73,81,91,101,111,121,133,145,
%T A200975 157,169,183,197,211,225,241,257,273,289,307,325,343,361,381,401,421,
%U A200975 441,463,485,507,529,553,577,601,625,651,677,703,729,757,785,813,841,871,901
%N A200975 Numbers on the diagonals in Ulam's spiral.
%C A200975 All entries are odd.
%C A200975 From _Bob Selcoe_, Oct 22 2014: (Start)
%C A200975 The following hold:
%C A200975 1. a(n) = (2k + 1)^2  when n = 4k + 1, k >= 0
%C A200975 2. a(n) = 4*k^2 + 1   when n = 4k - 1, k > 0
%C A200975 3  a(n) = k^2 + k + 1 when n = 2k, k > 0.
%C A200975 Conjecture 1: there must be at least one prime in [a(n), a(n+1)] inclusive.
%C A200975 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)
%H A200975 Todd Silvestri, <a href="/A200975/b200975.txt">Table of n, a(n) for n = 1..1000</a>
%H A200975 Project Euler, <a href="http://projecteuler.net/problem=28">Problem 28: Number spiral diagonals</a>
%H A200975 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (2,-1,0,1,-2,1).
%F A200975 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]
%F A200975 G.f.: -x*(1+x+x^5-x^4) / ( (1+x)*(x^2+1)*(x-1)^3 ). - _R. J. Mathar_, Nov 28 2011
%F A200975 a(n) = (2*n*(n+2)+(-1)^n-4*sin((Pi*n)/2)+7)/8 = (A249356(n)+7)/8. - _Todd Silvestri_, Oct 25 2014
%F A200975 a(n) = floor_(n*(n+2)/4) + floor_(n(mod 4)/3) + 1. - _Bob Selcoe_, Oct 27 2014
%e A200975 The numbers between ** are in this sequence.
%e A200975 .
%e A200975   *21*--22---23---24--*25*
%e A200975     |
%e A200975     |
%e A200975    20   *7*---8---*9*--10
%e A200975     |    |              |
%e A200975     |    |              |
%e A200975    19    6   *1*---2   11
%e A200975     |    |         |    |
%e A200975     |    |         |    |
%e A200975    18   *5*---4---*3*  12
%e A200975     |                   |
%e A200975     |                   |
%e A200975   *17*--16---15---14--*13*
%t A200975 Sort@ Flatten@ Table[4n^2 + (2j - 4)n + 1, {j, 0, 3}, {n, 16}] (* _Robert G. Wilson v_, Jul 10 2014 *)
%t A200975 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 *)
%o A200975 (Python)
%o A200975 # prints all numbers on the diagonals of a sq*sq spiral
%o A200975 sq = 5
%o A200975 d = 1
%o A200975 while 2*d - 1 < sq:
%o A200975     print(4*d*d - 4*d +1)
%o A200975     print(4*d*d - 4*d +1 + 1* 2* d)
%o A200975     print(4*d*d - 4*d +1 + 2* 2* d)
%o A200975     print(4*d*d - 4*d +1 + 3* 2* d)
%o A200975     d += 1
%o A200975 print(sq*sq)
%o A200975 (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 */
%Y A200975 Cf. A016754, A054554, A053755, and A054569 interleaved, A002620,
%Y A200975 Cf. A121658 (complementary)
%K A200975 nonn,easy
%O A200975 1,2
%A A200975 _Ismael Bouya_, Nov 25 2011
%E A200975 Edited with more terms by _Franklin T. Adams-Watters_, Nov 26 2011