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

A296030 Pairs of coordinates for successive integers in the square spiral (counterclockwise).

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, -1, 1, -1, 0, -1, -1, 0, -1, 1, -1, 2, -1, 2, 0, 2, 1, 2, 2, 1, 2, 0, 2, -1, 2, -2, 2, -2, 1, -2, 0, -2, -1, -2, -2, -1, -2, 0, -2, 1, -2, 2, -2, 3, -2, 3, -1, 3, 0, 3, 1, 3, 2, 3, 3, 2, 3, 1, 3, 0, 3, -1, 3, -2, 3, -3, 3, -3, 2
Offset: 1

Views

Author

Benjamin Mintz, Dec 03 2017

Keywords

Comments

The spiral is also called the Ulam spiral, cf. A174344, A274923 (x and y coordinates). - M. F. Hasler, Oct 20 2019
The n-th positive integer occupies the point whose x- and y-coordinates are represented in the sequence by a(2n-1) and a(2n), respectively. - Robert G. Wilson v, Dec 03 2017
From Robert G. Wilson v, Dec 05 2017: (Start)
The cover of the March 1964 issue of Scientific American (see link) depicts the Ulam Spiral with a heavy black line separating the numbers from their non-sequential neighbors. The pairs of coordinates for the points on this line, assuming it starts at the origin, form this sequence, negated.
The first number which has an abscissa value of k beginning at 0: 1, 2, 10, 26, 50, 82, 122, 170, 226, 290, 362, 442, 530, 626, 730, 842, 962, ...; g.f.: -(x^3 +7x^2 -x +1)/(x-1)^3;
The first number which has an abscissa value of -k beginning at 0: 1, 5, 17, 37, 65, 101, 145, 197, 257, 325, 401, 485, 577, 677, 785, 901, ...; g.f.: -(5x^2 +2x +1)/(x-1)^3;
The first number which has an ordinate value of k beginning at 0: 1, 3, 13, 31, 57, 91, 133, 183, 241, 307, 381, 463, 553, 651, 757, 871, 993, ...; g.f.: -(7x^2+1)/(x-1)^3;
The first number which has an ordinate value of -k beginning at 0: 1, 7, 21, 43, 73, 111, 157, 211, 273, 343, 421, 507, 601, 703, 813, 931, ...; g.f.: -(3x^2+4x+1)/(x-1)^3;
The union of the four sequences above is A033638.
(End)
Sequences A174344, A268038 and A274923 start with the integer 0 at the origin (0,0). One might then prefer offset 0 as to have (a(2n), a(2n+1)) as coordinates of the integer n. - M. F. Hasler, Oct 20 2019
This sequence can be read as an infinite table with 2 columns, where row n gives the x- and y-coordinate of the n-th point on the spiral. If the point at the origin has number 0, then the points with coordinates (n,n), (-n,n), (n,-n) and (n,-n) have numbers given by A002939(n) = 2n(2n-1): (0, 2, 12, 30, ...), A016742(n) = 4n^2: (0, 4, 16, 36, ...), A002943(n) = 2n(2n+1): (0, 6, 20, 42, ...) and A033996(n) = 4n(n+1): (0, 8, 24, 48, ...), respectively. - M. F. Hasler, Nov 02 2019

Examples

			The integer 1 occupies the initial position, so its coordinates are {0,0}; therefore a(1)=0 and a(2)=0.
The integer 2 occupies the position immediately to the right of 1, so its coordinates are {1,0}.
The integer 3 occupies the position immediately above 2, so its coordinates are {1,1}; etc.
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 935.

Crossrefs

Cf. Diagonal rays (+-n,+-n): A002939 (2n(2n-1): 0, 2, 12, 30, ...: NE), A016742 (4n^2: 0, 4, 16, 36, ...: NW), A002943 (2n(2n+1): 0, 6, 20, 42, ...: SW) and A033996 (4n(n+1): 0, 8, 24, 48, ...: SE).

Programs

  • Mathematica
    f[n_] := Block[{k = Ceiling[(Sqrt[n] - 1)/2], m, t}, t = 2k +1; m = t^2; t--; If[n >= m - t, {k -(m - n), -k}, m -= t; If[n >= m - t, {-k, -k +(m - n)}, m -= t; If[n >= m - t, {-k +(m - n), k}, {k, k -(m - n - t)}]]]]; Array[f, 40] // Flatten (* Robert G. Wilson v, Dec 04 2017 *)
    f[n_] := Block[{k = Mod[ Floor[ Sqrt[4 If[OddQ@ n, (n + 1)/2 - 2, (n/2 - 2)] + 1]], 4]}, f[n - 2] + If[OddQ@ n, Sin[k*Pi/2], -Cos[k*Pi/2]]]; f[1] = f[2] = 0; Array[f, 90] (* Robert G. Wilson v, Dec 14 2017 *)
    f[n_] := With[{t = Round@ Sqrt@ n}, 1/2*(-1)^t*({1, -1}(Abs[t^2 - n] - t) + t^2 - n - Mod[t, 2])]; Table[f@ n, {n, 0, 95}] // Flatten (* Mikk Heidemaa May 23 2020, after Stephen Wolfram *)
  • PARI
    apply( {coords(n)=my(m=sqrtint(n), k=m\/2); if(m <= n -= 4*k^2, [n-3*k,-k], n >= 0, [-k,k-n], n >= -m, [-k-n,k], [k,3*k+n])}, [0..99]) \\ Use concat(%) to remove brackets '[', ']'. This function gives the coordinates of n on the spiral starting with 0 at (0,0), as shown in Examples for A174344, A274923, ..., so (a(2n-1),a(2n)) = coords(n-1). To start with 1 at (0,0), change n to n-=1 in sqrtint(). The inverse function is pos(x,y) given e.g. in A316328. - M. F. Hasler, Oct 20 2019
  • Python
    from math import ceil, sqrt
    def get_coordinate(n):
        k=ceil((sqrt(n)-1)/2)
        t=2*k+1
        m=t**2
        t=t-1
        if n >= m - t:
            return k - (m-n), -k
        else:
            m -= t
        if n >= m - t:
            return -k, -k+(m-n)
        else:
            m -= t
        if n >= m-t:
            return -k+(m-n), k
        else:
            return k, k-(m-n-t)
    

Formula

a(2*n-1) = A174344(n).
a(2*n) = A274923(n) = -A268038(n).
abs(a(n+2) - a(n)) < 2.
a(2*n-1)+a(2*n) = A180714(n).
f(n) = floor(-n/4)*ceiling(-3*n/4 - 1/4) mod 2 + ceiling(n/8) (gives the pairs of coordinates for integers in the diagonal rays). - Mikk Heidemaa, May 07 2020

A168025 Noncomposite numbers in the western ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.

Original entry on oeis.org

1, 19, 151, 1621, 2731, 3631, 4129, 7789, 11719, 12601, 14461, 15439, 17491, 20809, 28309, 29671, 32491, 41719, 59659, 69829, 78541, 83089, 85411, 92569, 97501, 115771, 132679, 138571
Offset: 0

Views

Author

Alonso del Arte, Nov 16 2009

Keywords

Crossrefs

Cf. A054567.

Programs

  • Mathematica
    Select[Table[4 n^2 - 7 n + 4, {n, 0, 199}], Length[Divisors[ # ]] < 3 &]

Formula

Positive numbers of the form 4n^2 - 7n + 4 with no more than two divisors.

A168026 Noncomposite numbers in the southwestern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.

Original entry on oeis.org

1, 7, 43, 73, 157, 211, 421, 601, 1483, 2551, 2971, 3907, 4423, 6163, 6481, 8191, 12211, 19183, 22651, 26407, 27061, 28393, 31153, 35533, 37057, 37831, 42643, 47743, 55933, 60763, 71023, 74257, 77563, 83233, 84391, 98911, 110557, 113233
Offset: 1

Views

Author

Alonso del Arte, Nov 16 2009

Keywords

Comments

From Peter Munn, Mar 17 2018: (Start)
Noncomposites of the form k^2 + k + 1 with k even and nonnegative (and the same values occur with k odd and negative). Equivalently, noncomposites of the form 4k^2 + 2k + 1 with k >= 0, or 4k^2 - 6k + 3 with k > 0.
A073337 lists those of the form k^2 + k + 1 with k odd and positive, and this is equivalently those of the form 4k^2 - 2k + 1 with k > 0.
(End)
Numbers that are the sum of A000217(2*k-3) + A000217(2*k-1) that result in either unity or a prime, for k,n >= 1. For k,n >= 0, a(n+1) = 4*k*2 + 2*k + 1 will give the same results. - J. M. Bergot, May 07 2018

Crossrefs

Cf. A054569, all numbers of the form 4k^2 - 6k + 3 with k > 0. Noncomposites of the eastern ray are in A168022. Primes of the northeastern ray are in A073337. Noncomposites of the northern ray are in A168023. Primes of the northwestern ray are in A121326. Noncomposites of the western ray are in A168025. Noncomposites of the southern ray are in A168027.

Programs

  • Mathematica
    Select[Table[4 n^2 - 6 n + 3, {n, 200}], Length[Divisors[ # ]] < 3 &]
  • PARI
    lista(nn) = {print1(1, ", "); for(k=1, nn, if(isprime(p=4*k^2-6*k+3), print1(p, ", ")));} \\ Altug Alkan, Mar 22 2018

Formula

Numbers of the form 4k^2 - 6k + 3 with k > 0 and no more than two divisors. [corrected by Peter Munn, Mar 17 2018]

A168023 Noncomposite numbers in the northern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.

Original entry on oeis.org

1, 61, 139, 1009, 1279, 2281, 3109, 3571, 4591, 6361, 8419, 13399, 14341, 17359, 19531, 23029, 35251, 39901, 44839, 46549, 51871, 55579, 61381, 73849, 76039, 102241, 110059, 135241, 153469, 156619
Offset: 1

Views

Author

Alonso del Arte, Nov 16 2009

Keywords

Crossrefs

Cf. A054556, all numbers of the form 4n^2 - 9n + 6. Noncomposites of the eastern ray are in A168022. Primes of the northeastern ray are in A073337. Noncomposites of the northwestern ray are in A168024. Noncomposites of the western ray are in A168025. Noncomposites of the southwestern ray are in A168026. Noncomposites of the southern ray are in A168027.

Programs

  • Mathematica
    Select[Table[4 n^2 - 9 n + 6, {n, 200}], Length[Divisors[ # ]] < 3 &]

Formula

Positive numbers of the form 4n^2 - 9n + 6 with no more than two divisors.

A168027 Noncomposite numbers in the southern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.

Original entry on oeis.org

1, 23, 163, 281, 431, 613, 827, 2003, 2377, 3221, 3691, 6521, 7877, 10151, 10973, 11827, 12713, 17623, 18701, 23333, 24571, 25841, 27143, 28477, 38711, 43577, 45263, 48731, 50513, 65921, 72227, 81083, 85703, 95327, 97813, 102881, 124433
Offset: 0

Views

Author

Alonso del Arte, Nov 16 2009

Keywords

Crossrefs

Cf. A033951, all numbers of the form 4n^2 + 3n + 1. Noncomposites of the eastern ray are in A168022. Primes of the northeastern ray are in A073337. Noncomposites of the northern ray are in A168023. Primes of the northwestern ray are in A121326. Noncomposites of the western ray are in A168025. Noncomposites of the southwestern ray are in A168026. There are no primes on the southeastern ray, which, being A016754, are the odd squares, and thus none of them are prime.

Programs

  • Mathematica
    Select[Table[4 n^2 + 3 n + 1, {n, 0, 199}], Length[Divisors[ # ]] < 3 &]

Formula

Positive numbers of the form 4n^2 + 3n + 1 with no more than two divisors.

A168024 Noncomposite numbers in the northwestern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.

Original entry on oeis.org

1, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601, 2917, 3137, 4357, 5477, 7057, 8101, 8837, 12101, 13457, 14401, 15377, 15877, 16901, 17957, 21317, 22501, 24337, 25601, 28901, 30977, 32401, 33857
Offset: 0

Views

Author

Alonso del Arte, Nov 16 2009

Keywords

Crossrefs

Essentially the same sequence as A002496, A121326, A163588.
Cf. A053755, all numbers of the form 4n^2 + 1. Noncomposites of the eastern ray are in A168022. Primes of the northeastern ray are in A073337. Noncomposites of the northern ray are in A168023. Primes of the northwestern ray are in A121326 (the same as this sequence but without the initial 1). Noncomposites of the western ray are in A168025. Noncomposites of the southwestern ray are in A168026. Noncomposites of the southern ray are in A168027.

Programs

  • Mathematica
    Select[Table[4 n^2 + 1, {n, 0, 99}], Length[Divisors[ # ]] < 3 &]

Formula

Positive numbers of the form 4n^2 + 1 with no more than two divisors.

A078784 Primes on axis of Ulam square spiral (with rows ... / 7 8 9 / 6 1 2 / 5 4 3 / ... ) with origin at (1).

Original entry on oeis.org

2, 11, 19, 23, 53, 61, 127, 139, 151, 163, 233, 281, 431, 541, 613, 743, 827, 977, 1009, 1279, 1621, 1871, 2003, 2281, 2377, 2731, 3109, 3221, 3511, 3571, 3631, 3691, 4001, 4129, 4523, 4591, 5077, 6361, 6521, 7789, 7877, 8419, 9851, 10151, 10973, 11503, 11719, 11827, 12377, 12601, 12713, 13399
Offset: 1

Views

Author

Donald S. McDonald, Jan 10 2003

Keywords

Comments

Quadrants are numbered clockwise: 4=north, 1=east, 2=south, 3=west. The spiral numbers falling on axes (whether prime or not) are 4=north (2n+1)^2-n, 1=east (2n+1)^2+n+1, 2=south (2n)^2-(n-1), 3=west (2n)^2+n+1.
Primes to the left, right, above or below the 1 in the example in A054552.
This is the union of the primes in A168022, A168023, A168025 and A168027. - R. J. Mathar, Jul 11 2014

Examples

			For n=0, quadrant = 1, a(1) =  2, distance = 1;
for n=1, quadrant = 1, a(2) = 11, distance = 2;
for n=2, quadrant = 3, a(3) = 19, distance = 2.
		

Crossrefs

Programs

  • Mathematica
    Select[ Sort@ Flatten@ Table[ 4n^2 + (2j - 3)n + 1, {j, 0, 3}, {n, 58}], PrimeQ] (* Robert G. Wilson v, Jul 10 2014 *)

Formula

Primes in A039823(n) = ceiling((n^2 + n + 2)/4). - Georg Fischer, Dec 04 2024

Extensions

a(12) onward from Robert G. Wilson v, Jul 10 2014
Showing 1-7 of 7 results.