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

A256891 Smallest primes of 3 X 3 magic squares formed from consecutive primes.

Original entry on oeis.org

1480028129, 1850590057, 5196185947, 5601567187, 5757284497, 6048371029, 6151077269, 9517122259, 19052235847, 20477868319, 23813359613, 24026890159, 26748150199, 28519991387, 34821326119, 44420969909, 49285771679, 73827799009, 73974781889, 74220519319, 76483907837, 76560277009, 80143089599, 85892025227, 89132925737, 95515449037, 99977424653
Offset: 1

Views

Author

Arkadiusz Wesolowski, Apr 12 2015

Keywords

Comments

Let a = a(n) for some n and {a, b, c, d, e, f, g, h, i} be the set of consecutive primes. Then it is:
+---+---+---+ +---+---+---+
| d | c | h | | c | d | h |
+---+---+---+ +---+---+---+
| i | e | a | (type 1), or | i | e | a | (type 2). See Harvey D. Heinz.
+---+---+---+ +---+---+---+
| b | g | f | | b | f | g |
+---+---+---+ +---+---+---+
The type is determined by the sign of A343195.
For a given magic sum S, it is easy to calculate the unique set of n^2 consecutive primes that sum up to n*S (see PROGRAM MagicPrimes() in A073519), and in particular the smallest of these (cf. PROGRAM), listed here for n = 3, in A260673 for n = 4, in A272386 for n = 5, and in A272387 for n = 6. - M. F. Hasler, Oct 28 2018

References

  • Allan W. Johnson, Jr., Consecutive-Prime Magic Squares, Journal of Recreational Mathematics, vol. 15, 1982-83, pp. 17-18.
  • H. L. Nelson, A Consecutive Prime 3 x 3 Magic Square, Journal of Recreational Mathematics, vol. 20:3, 1988, p. 214.

Crossrefs

Programs

  • Magma
    /* Brute-force search */ lst:=[]; n:=3; while n lt 10^11 do a:=NextPrime(n); q:=a; j:=a-n; if j mod 6 eq 0 then b:=NextPrime(a); if j eq b-a then c:=NextPrime(b); d:=c-b; if d mod 6 eq 0 then e:=NextPrime(c); k:=e-c; if k eq j then f:=NextPrime(e); if k eq f-e then g:=NextPrime(f); if g-f eq d then h:=NextPrime(g); m:=h-g; if m eq k then i:=NextPrime(h); if h-g eq i-h then Append(~lst, n); end if; end if; end if; end if; end if; end if; end if; end if; n:=q; end while; lst;
    
  • PARI
    A256891(n)=MagicPrimes(A270305(n),3)[1] \\ See A073519 for MagicPrimes(). - M. F. Hasler, Oct 28 2018

Formula

a(n) = A151799(A151799(A151799(A151799(A166113(n))))). - Max Alekseyev, Nov 02 2015

Extensions

Extended by Max Alekseyev, Nov 02 2015

A173981 Magic constants of 4 X 4 magic squares which consist of consecutive primes.

Original entry on oeis.org

258, 276, 5118, 19896, 50478, 13039980, 13297678, 37166532, 96266778, 104100834, 185320518, 383918304, 397075158, 467692578, 683981178, 816166200, 852339780, 874276354, 919926054, 931402662, 1016171040, 1021731906, 1026857286, 1200889680, 1501212942, 1533729354, 1686059670
Offset: 1

Views

Author

Natalia Makarova, Mar 04 2010

Keywords

Comments

Necessary conditions for 16 primes from which a magic square of order 4 can be made, are:
1. Their sum S is a multiple of 4
2. Magic constant of possible square K=S/4 is even number.
This is equivalent to the requirement for S to be a multiple of 8.
For a fixed magic constant S, it is easy to obtain the set of n^2 consecutive primes that sum up to n*S, and in particular the smallest one: see the PROGRAM in A260673 which computes the smallest prime for any of the magic sums listed here (for n = 4), and A272386 for the n = 5 analog. The converse is trivial, cf. FORMULA and PROGRAM below. - M. F. Hasler, Oct 28 2018

Examples

			The smallest magic square of order 4 has the constant of 258. See A073520 and A073521.
The following array of 16 consecutive primes:
   37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
also produces the magic square with the constant of K = 276:
    [ 41 37 97 101]
    [103 83 47  43]
    [ 71 67 79  59]
    [ 61 89 53  73]
But then not every array of 16 consecutive primes produces a magic square. The next magic square can be made from the array (1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321):
    [1229 1249 1321 1319]
    [1301 1303 1231 1283]   (K = 5118)
    [1297 1277 1307 1237]
    [1291 1289 1259 1279]
Two more examples:
    [4943 4933 5011 5009]                   [12553 12583 12689 12653]
    [4999 4973 4967 4957]   (K = 19896),    [12641 12647 12601 12589]   (K = 50478)
    [5003 4969 4987 4937]                   [12671 12611 12619 12577]
    [4951 5021 4931 4993]                   [12613 12637 12569 12659]
		

Crossrefs

Cf. A073520, A073521, A260673 (smallest terms in magic 4 X 4 squares of consecutive primes), A270865 (idem for semimagic squares). Subsequence of A270864 (analog for semimagic squares).
Cf. A270305 (analog for 3 X 3), A177434 (analog for 6 X 6).

Programs

  • PARI
    A173981(n, p=A260673[n], N=4)=sum(i=2, N^2, p=nextprime(p+1), p)/N \\ Illustration of the formula. - M. F. Hasler, Oct 28 2018

Formula

a(n) = Sum_{k=0..15} A000040(A000720(A260673(n))+k)/4. - M. F. Hasler, Oct 28 2018

Extensions

a(24)-a(25) from Arkadiusz Wesolowski, Dec 13 2015
Edited and added a(26)-a(27) (using A260673) by M. F. Hasler, Oct 30 2018

A320873 List of 3 X 3 magic squares made of consecutive primes, in order of increasing magic sum. Only the lexicographically smallest variant of equivalent squares (modulo D4 symmetries) is listed, as a row containing the 3 rows of the square.

Original entry on oeis.org

1480028141, 1480028189, 1480028183, 1480028213, 1480028171, 1480028129, 1480028159, 1480028153, 1480028201, 1850590069, 1850590117, 1850590111, 1850590141, 1850590099, 1850590057, 1850590087, 1850590081, 1850590129, 5196185959, 5196186007, 5196186001, 5196186031, 5196185989, 5196185947, 5196185977, 5196185971, 5196186019
Offset: 1

Views

Author

M. F. Hasler, Oct 22 2018

Keywords

Comments

The first row is the lexicographically first 3 X 3 magic square of consecutive primes with the smallest possible magic constant 4440084513 = A270305(1) = A073520(3).
The same 9 terms are also given in increasing order in sequence A073519. But this is equivalent of giving just the smallest of the terms (cf. A256891) or the central element (cf. A166113) or the magic constant itself (cf. A270305), which uniquely determines the sequence of primes since they have to be consecutive and their sum is equal to 3 times the magic constant.
In the case of 3 X 3 magic squares, however, the lexicographically smallest representative has its elements in a well-defined order, see comment in A320872. This allows the reconstruction of the square from the set of primes which can be computed from the central elements A166113 or magic constants A270305, cf. PROGRAM in A073519.

Examples

			The first row of 9 terms, (1480028141, 1480028189, 1480028183, 1480028213, 1480028171, 1480028129, 1480028159, 1480028153, 1480028201), corresponds to the following smallest 3 X 3 magic square of consecutive primes:
    [1480028141  1480028189  1480028183]
    [1480028213  1480028171  1480028129] .
    [1480028159  1480028153  1480028201]
The eleventh row yields the first example where the second term is smaller than the third one:
    [23813359643  23813359721  23813359727]
    [23813359781  23813359697  23813359613] .
    [23813359667  23813359673  23813359751]
		

References

  • Allan W. Johnson, Jr., Journal of Recreational Mathematics, vol. 23:3, 1991, pp. 190-191.
  • Clifford A. Pickover, The Zen of Magic Squares, Circles and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002.

Crossrefs

Cf. A073520 (smallest magic sum for a n X n magic square made from consecutive primes).
Cf. A104157 (smallest of n^2 consecutive primes forming a magic square).
Cf. A166113 (center element of 3 X 3 magic squares of consecutive primes).
Cf. A256891 (smallest entry of 3 X 3 magic squares of consecutive primes) = A151799^4(A166113).
Cf. A270305 (magic sums of 3 X 3 magic squares of consecutive primes) = 3*A166113.

Programs

  • PARI
    A320873_row(n)=vecextract(n=MagicPrimes(3*A166113[n],3),[2,6+n=n[2]*2==n[1]+n[3],7-n,9,5,1,3+n,4-n,8]) \\ For MagicPrimes() see A073519 (the set of primes of the first row).
    /* the following allows the production of all 8 variants of a magic square that are equivalent modulo reflection on any of the 4 symmetry axes of the square */
    REV(M)=matconcat(Vecrev(M)) \\ reverse the order of columns of M
    FLIP(M)=matconcat(Colrev(M)) \\ reverse the order of rows of M
    ALL(M,C(f,L)=concat(apply(f,L),L))=Set(C(REV,C(FLIP,[M,M~]))) \\ PARI orders the set according to the (first) columns of the matrices, so one must take the transpose to get them ordered according to elements of the first row.

Formula

a(9n-4) = A166113(n) = A270305(n)/3 for all n >= 1.

A024351 Primes forming a 3 X 3 magic square with prime entries and minimal constant 177 = A164843(3).

Original entry on oeis.org

5, 17, 29, 47, 59, 71, 89, 101, 113
Offset: 1

Views

Author

Karl Schmerbauch (karl.j.schmerbauch(AT)boeing.com)

Keywords

Comments

The minimal 3 X 3 magic square made of consecutive primes has constant 4440084513 = A073520(3) = A270305(1), cf. A073519. - M. F. Hasler, Oct 22 2018
Sequence A073473 gives a variant using "primes including 1" (for historical reasons), to which also refers A073502. - M. F. Hasler, Oct 24 2018

Examples

			The square is [101 5 71 ; 29 59 89 ; 47 113 17].
The lexicographically smallest equivalent variant (modulo reflections on the symmetry axes of the square) is [17 89 71 ; 113 59 5 ; 47 29 101], cf. A320872. - _M. F. Hasler_, Oct 24 2018
		

Crossrefs

Cf. A320872 (3 X 3 magic squares of primes), A268790 (magic sums of these).

Programs

  • PARI
    A024351=select(p->setsearch(P,118-p),P=primes(30)[^5]) \\ 118 = 2*59, where 59 is the central prime; primes(30) = primes < 118. For the magic square itself, use A320872_row(1). -  M. F. Hasler, Oct 25 2018

Extensions

Offset corrected by Arkadiusz Wesolowski, Nov 26 2011

A166113 Center element of a 3 X 3 magic square composed of consecutive primes.

Original entry on oeis.org

1480028171, 1850590099, 5196185989, 5601567229, 5757284539, 6048371071, 6151077311, 9517122301, 19052235889, 20477868361, 23813359697, 24026890201, 26748150313, 28519991429, 34821326161, 44420969951, 49285771751, 73827799051, 73974781931, 74220519391, 76483907879, 76560277051, 80143089671, 85892025269, 89132925809, 95515449079, 99977424731
Offset: 1

Views

Author

Max Alekseyev, Oct 06 2009

Keywords

Crossrefs

Cf. A073519, A256891, A270305. Subsequence of A096710.

Formula

An element p of A096710 belongs to this sequence iff q+r=s+p and (q+s=p+t or r+s=p+t), where p,q,r,s,t are consecutive primes.
a(n) = A270305(n)/3. - Arkadiusz Wesolowski, Mar 14 2016

Extensions

Extended by Max Alekseyev, Oct 13 2009
a(19)-a(27) added by Natalia Makarova, Oct 30 2015

A268912 Magic sums of 3 X 3 semimagic squares composed of consecutive primes.

Original entry on oeis.org

65573, 72337, 165679, 167429, 167479, 311981, 376907, 383183, 417943, 449933, 725411, 733643, 740749, 854119, 884311, 1132717, 1176781, 1229731, 1247899, 1256659, 1529543, 1681439, 2111153, 2238667, 2372927, 2536175, 2725573, 2787865, 2822663, 2849927, 2937691
Offset: 1

Views

Author

Arkadiusz Wesolowski, Feb 15 2016

Keywords

Crossrefs

Cf. A265139, A265614, A256891. Supersequence of A270305.

A343194 a(n) is the parameter b in the three-parameter description of 3 X 3 magic squares of consecutive primes (see comment).

Original entry on oeis.org

12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 30, 12, 30, 12, 12, 12, 30, 12, 12, 30, 12, 12, 30, 12, 30, 12, 18, 12, 12, 30, 12, 30, 12, 18, 12, 12, 12, 12, 30, 12, 12, 60, 30, 12, 12, 12, 30, 30, 12, 6, 30, 30, 18, 18, 42, 12, 12, 42, 12, 12, 18, 12, 12, 12, 12, 30
Offset: 1

Views

Author

A.H.M. Smeets, Apr 07 2021

Keywords

Comments

Each 3 X 3 magic square of consecutive primes can be described by three parameters: p1, b and c, where p1 is the smallest prime in the magic square, b > 0 and c > -b; the magic square is then given by:
+----------+----------+----------+
| p1+5b+2c | p1 | p1+4b+c |
+----------+----------+----------+
| p1+2b | p1+3b+c | p1+4b+2c |
+----------+----------+----------+
| p1+2b+c | p1+6b+2c | p1+b |
+----------+----------+----------+
p1 is given in A256891 and c is given in A343195.
If c > 0, the magic square is of type 1; if -b < c < 0, the magic square is of type 2. If the consecutive primes are given by p1, p2, ..., p9 (in increasing order), the magic square types are given by:
Type 1 Type 2
+----+----+----+ +----+----+----+
| p8 | p1 | p6 | | p8 | p1 | p7 |
+----+----+----+ +----+----+----+
| p3 | p5 | p7 | | p4 | p5 | p6 |
+----+----+----+ +----+----+----+
| p4 | p9 | p2 | | p3 | p9 | p2 |
+----+----+----+ +----+----+----+

Crossrefs

Cf. A166113 (p5), A256891 (p1), A270305 (magic constant), A343195 (c).

Formula

a(n) = (A270305(n) - 3*A256891(n) - 3*A343195(n))/9.
a(n) = (A166113(n) - A256891(n) - A343195(n))/3.

A343195 a(n) is the parameter c in the three parameter description of 3 X 3 magic squares of consecutive primes (see comment).

Original entry on oeis.org

6, 6, 6, 6, 6, 6, 6, 6, 6, 6, -6, 6, 24, 6, 6, 6, -18, 6, 6, -18, 6, 6, -18, 6, -18, 6, 24, 6, 6, -6, 6, -18, 6, 24, 6, 6, 6, 6, -18, 6, 6, -54, -18, 6, 6, 6, -18, 12, 6, 78, 12, -18, 24, 24, -24, 6, 6, 6, 6, 6, 24, 6, 6, 6, 6, 12, 12, 24, 6, 6, 24, -18, 6, 24
Offset: 1

Views

Author

A.H.M. Smeets, Apr 07 2021

Keywords

Comments

Each 3 X 3 magic square of consecutive primes can be described by three parameters: p1, b and c, where p1 is the smallest prime in the magic square, b > 0 and c > -b; the magic square is then given by:
+----------+----------+----------+
| p1+5b+2c | p1 | p1+4b+c |
+----------+----------+----------+
| p1+2b | p1+3b+c | p1+4b+2c |
+----------+----------+----------+
| p1+2b+c | p1+6b+2c | p1+b |
+----------+----------+----------+
p1 is given in A256891 and b is given in A343194.
If c > 0, the magic square is of type 1; if -b < c < 0, the magic square is of type 2. If the consecutive primes are given by p1, p2, ..., p9 (in increasing order), the magic square types are given by:
Type 1 Type 2
+----+----+----+ +----+----+----+
| p8 | p1 | p6 | | p8 | p1 | p7 |
+----+----+----+ +----+----+----+
| p3 | p5 | p7 | | p4 | p5 | p6 |
+----+----+----+ +----+----+----+
| p4 | p9 | p2 | | p3 | p9 | p2 |
+----+----+----+ +----+----+----+

Crossrefs

Cf. A166113 (p5), A256891 (p1), A270305 (magic constant), A343194 (b).

Formula

a(n) = (A270305(n) - 3*A256891(n) - 9*A343194(n))/3.
a(n) = A166113(n) - A256891(n) - 3*A343194(n).

A320871 List of all inequivalent 3 X 3 magic squares made of distinct positive integers, sorted by increasing sum. For each equivalence class modulo symmetries of the square, the lexicographically smallest representative is shown.

Original entry on oeis.org

2, 7, 6, 9, 5, 1, 4, 3, 8, 2, 9, 7, 11, 6, 1, 5, 3, 10, 3, 7, 8, 11, 6, 1, 4, 5, 9, 3, 8, 7, 10, 6, 2, 5, 4, 9, 2, 11, 8, 13, 7, 1, 6, 3, 12, 3, 10, 8, 12, 7, 2, 6, 4, 11, 4, 8, 9, 12, 7, 2, 5, 6, 10, 4, 9, 8, 11, 7, 3, 6, 5, 10, 2, 13, 9, 15, 8, 1, 7, 3, 14, 3, 11, 10, 15, 8, 1, 6, 5, 13
Offset: 1

Views

Author

M. F. Hasler, Oct 28 2018

Keywords

Comments

"Symmetries of the square" means the symmetry group D4 consisting of reflections on any of the 4 symmetry axes of the square (horizontal H, vertical V, 2 diagonals D & A), which also generates the rotations around the center by multiples of 90°, R1, R2, R3 (and R0 = id): e.g., H o D = R1, where D means to transpose the 3 X 3 matrix, H means reversal of the rows, etc.
The 8 ("equivalent") variants of the first square are listed in A217568.

Examples

			The first five inequivalent magic squares (with magic sums 15, 18, 18, 18, 21) are
   [2 7 6]    [ 2 9  7]    [ 3 7 8]    [ 3 8 7]    [ 2 11  8]
   [9 5 1]    [11 6  1]    [11 6 1]    [10 6 2]    [13  7  1]
   [4 3 8]    [ 5 3 10]    [ 4 5 9]    [ 5 4 9]    [ 6  3 12]
They are listed as rows of the 9 elements of each square, so the first row is:
  [2, 7, 6; 9, 5, 1; 4, 3, 8],
the second row is:
  [2, 9, 7; 11, 6, 1; 5, 3, 10], and so on.
		

Crossrefs

Cf. A217568: the 8 equivalent variants of the first row.
Cf. A320872: subsequence of rows that consist only of primes; A268790 lists their magic sums with duplicates removed.
Cf. A320873: the first row that consists of a set of consecutive primes; it has magic sum = 4440084513 = A270305(1) = A073520(3).

Programs

  • PARI
    A320871_row(N=10,show_all=1,c=3)={for(c=c,oo, forstep(d=c-1,2,-1, for(b=max(2*d+1-c,1), d-1, d!=2*b&& S=[c-d,c+b,c+d-b;c+2*d-b,c,c-2*d+b;c-d+b,c-b,c+d]; !(show_all&&print(S))&& !N--&& return(S))))} \\ The third (optional) argument allows starting the list with the first square(s) having the central element >= c, i.e., magic sum >= 3c.
Showing 1-9 of 9 results.