The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A200975 Numbers on the diagonals in Ulam's spiral. 4
 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 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) LINKS Todd Silvestri, Table of n, a(n) for n = 1..1000 Project Euler, Problem 28: Number spiral diagonals Index entries for linear recurrences with constant coefficients, signature (2,-1,0,1,-2,1). 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 EXAMPLE 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* 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 *) PROG (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) (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 */ CROSSREFS Cf. A016754, A054554, A053755, and A054569 interleaved, A002620, Cf. A121658 (complementary) Sequence in context: A222314 A228232 A182058 * A058871 A126278 A121259 Adjacent sequences:  A200972 A200973 A200974 * A200976 A200977 A200978 KEYWORD nonn,easy AUTHOR Ismael Bouya, Nov 25 2011 EXTENSIONS Edited with more terms by Franklin T. Adams-Watters, Nov 26 2011 STATUS approved

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

Last modified September 24 06:13 EDT 2021. Contains 347623 sequences. (Running on oeis4.)