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

A321610 Number of permutations tau of {1,...,n} such that k^2 + tau(k)^2 is prime for every k = 1,...,n.

Original entry on oeis.org

1, 1, 1, 1, 1, 4, 0, 16, 4, 144, 64, 81, 256, 5184, 1600, 25600, 8100, 183184, 108900, 5924356, 342225, 9066121, 11356900, 106853569, 105698961, 16119349444, 1419933124, 69792129124, 14251584400, 613950602500, 304388337796, 25042678198756, 10080904401936, 1179245283899881, 1045903153861476, 31082438574307129
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 14 2018

Keywords

Comments

Conjecture 1: The number a(n) is always a square, and a(n) = 0 only for n = 7.
Conjecture 2: For any positive integer n, there is a permutation tau of {1,...,n} such that k^2 + k*tau(k) + tau(k)^2 is prime for every k = 1,...,n.
See also A321597 and A321611 for similar conjectures.

Examples

			a(3) = 1, and (1,3,2) is a permutation of {1,2,3} with 1^2 + 1^2 = 2, 2^2 + 3^2 = 13 and 3^2 + 2^2 all prime.
a(5) = 1, and (1,3,2,5,4) is a permutation of {1,2,3,4,5} with 1^2 + 1^2 = 2, 2^2 + 3^2 = 13, 3^2 + 2^2 = 13, 4^2 + 5^2 = 41 and 5^2 + 4^2 = 41 all prime.
		

Crossrefs

Programs

  • Mathematica
    V[n_]:=V[n]=Permutations[Table[i,{i,1,n}]]
    Do[r=0;Do[Do[If[PrimeQ[i^2+Part[V[n],k][[i]]^2]==False,Goto[aa]],{i,1,n}];r=r+1;Label[aa],{k,1,n!}];Print[n," ",r],{n,1,11}]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, ispseudoprime(i^2 + j^2))); \\ Jinyuan Wang, Jun 13 2020

Extensions

a(12)-a(25) from Jud McCranie, Nov 15 2018
a(26)-a(28) from Jud McCranie, Nov 19 2018
a(29)-a(30) from Jinyuan Wang, Jun 13 2020
a(31)-a(36) from Vaclav Kotesovec, Aug 19 2021

A321611 Number of permutations tau of {1,...,n} such that k^4 + tau(k)^4 is prime for every k = 1,...,n.

Original entry on oeis.org

1, 1, 1, 4, 4, 4, 4, 64, 16, 144, 144, 0, 144, 144, 289, 4356, 2916, 22500, 79524, 1887876, 313600, 3459600, 2985984, 50069776, 32353344, 2056803904, 237591396, 11713732900, 10265337124, 342040164964, 30744816964, 2507750953744, 378640854244, 53517915572836, 7415600385600, 230030730231696
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 14 2018

Keywords

Comments

Conjecture: Each term of the sequence is a positive square.
See also A321597 and A321610 for similar conjectures.
This conjecture fails for n = 12. The values of a(12),...,a(20) were first computed by the user MTson on Mathoverflow. Ilya Bogdanov has confirmed that a(n) is indeed a square. See answers and comments to Question 315351 on Mathoverflow. - Zhi-Wei Sun, Nov 17 2018

Examples

			a(3) = 1, and (1,3,2) is a permutation of {1,...,n} with 1^4 + 1^4 = 2, 2^4 + 3^4 = 97 and 3^4 + 2^4 = 97 all prime.
		

Crossrefs

Programs

  • Mathematica
    V[n_]:=V[n]=Permutations[Table[i,{i,1,n}]]
    Do[r=0;Do[Do[If[PrimeQ[i^4+Part[V[n],k][[i]]^4]==False,Goto[aa]],{i,1,n}];r=r+1;Label[aa],{k,1,n!}];Print[n," ",r],{n,1,11}]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, ispseudoprime(i^4 + j^4))); \\ Jinyuan Wang, Jun 13 2020

Extensions

a(12)-a(27) from Jud McCranie, Nov 17 2018
a(28)-a(29) from Jinyuan Wang, Jun 13 2020
a(30)-a(36) from Vaclav Kotesovec, Aug 19 2021

A321727 Number of permutations f of {1,...,n} such that prime(k) + prime(f(k)) + 1 is prime for every k = 1,...,n.

Original entry on oeis.org

1, 1, 1, 2, 6, 10, 31, 76, 696, 4294, 5772, 8472, 128064, 147960, 1684788, 26114739, 523452320, 1029877159, 1772807946, 28736761941, 19795838613, 31445106424, 1313504660737, 54477761675626, 105122845176663, 2200119900732333, 2761739099984389, 83123428119278837, 219734505495953342, 7228968492870136475, 13623311188546432233, 625620139149376861330, 18603738861035365389401, 64952397216275572992159, 3115094155636931821691880, 4788927142804364353625983
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 17 2018

Keywords

Comments

Clearly, a(n) is also the permanent of the matrix of order n whose (i,j)-entry is 1 or 0 according as prime(i) + prime(j) + 1 is prime or not.
Conjecture: a(n) > 0 for all n > 0.
Note that there is no permutation f of {1,...,10} such that prime(k) + prime(f(k)) - 1 is prime for every k = 1,...,10.

Examples

			a(3) = 1, and (1,2,3) is a permutation of {1,2,3} with prime(1) + prime(1) + 1 = 5, prime(2) + prime(2) + 1 = 7 and prime(3) + prime(3) + 1 = 11 all prime.
a(4) = 2. In fact, (1,2,4,3) is a permutation of {1,2,3,4} with prime(1) + prime(1) + 1 = 5, prime(2) + prime(2) + 1 = 7, prime(3) + prime(4) + 1 = 13 and prime(4) + prime(3) + 1 = 13 all prime; also (1,4,3,2) is a permutation of {1,2,3,4} with prime(1) + prime(1) + 1 = 5, prime(2) + prime(4) + 1 = 11, prime(3) + prime(3) + 1 = 11 and prime(4) + prime(2) + 1 = 11 all prime.
		

Crossrefs

Programs

  • Maple
    b:= proc(s) option remember; (k-> `if`(k=0, 1, add(`if`(isprime(
          ithprime(i)+ithprime(k)+1), b(s minus {i}), 0), i=s)))(nops(s))
        end:
    a:= n-> b({$1..n}):
    seq(a(n), n=1..15);  # Alois P. Heinz, Nov 17 2018
  • Mathematica
    p[n_]:=p[n]=Prime[n];
    a[n_]:=a[n]=Permanent[Table[Boole[PrimeQ[p[i]+p[j]+1]],{i,1,n},{j,1,n}]];
    Do[Print[n," ",a[n]],{n,1,22}]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, ispseudoprime(prime(i)+prime(j)+1))); \\ Jinyuan Wang, Jun 13 2020

Extensions

a(23)-a(26) from Alois P. Heinz, Nov 17 2018
a(27)-a(28) from Jinyuan Wang, Jun 13 2020
a(29)-a(36) from Vaclav Kotesovec, Aug 19 2021

A321805 Number of permutations f of {1,...,n} such that k!*f(k) + 1 is prime for every k from 1 to n.

Original entry on oeis.org

1, 2, 4, 6, 10, 10, 13, 40, 212, 702, 3531, 19008, 34858, 39764, 102312, 47927, 94860, 232006, 658766, 829583, 1547703, 2040211, 32073218, 51347260, 496226762, 1504307318, 16663026685, 125080784519, 241032642271, 1216752358950, 2147004248698, 9320087810948, 19383919945950, 16259146126113, 81023699301023, 124167501991213
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 19 2018

Keywords

Comments

Though the first 27 terms are positive, we have a(50) = 0 since all the numbers 50!*k + 1, with k = 1..50, are composite.

Examples

			a(2) = 2 since (1,2) and (2,1) are permutations of {1,2} with 1!*1 + 1 = 2, 2!*2 + 1 = 5, 1!*2 + 1 = 3 and 2!*1 + 1 = 3 all prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=a[n]=Permanent[Table[Boole[PrimeQ[i!*j+1]],{i,1,n},{j,1,n}]]; Do[Print[n," ",a[n]],{n,1,27}]
  • PARI
    a(n)={matpermanent(matrix(n, n, i, j, isprime(i!*j+1)))} \\ Andrew Howroyd, Nov 19 2018

Extensions

a(28)-a(31) from Jinyuan Wang, Jun 13 2020
a(32)-a(36) from Vaclav Kotesovec, Aug 19 2021

A321855 Number of permutations f of {1,...,n} such that prime(k)*prime(f(k)) - 2 is prime for every k = 1,...,n.

Original entry on oeis.org

1, 1, 2, 3, 5, 12, 2, 3, 65, 248, 448, 1792, 4288, 6468, 27068, 29752, 106066, 447982, 1250762, 6304196, 46613084, 126391780, 504582496, 2270372946, 3028652541, 8941959118, 36442298864, 175008626450, 318369805106, 1974700703920, 6654020288821, 48819526290634, 150577775767875, 574885284627624, 3058310882340228, 15949743649457780
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 19 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0. Moreover, for each n > 0, there is an even permutation f of {1,...,n} with prime(k)*prime(f(k)) - 2 prime for all k = 1,...,n. Also, for any integer n > 2, there is an odd permutation f of {1,...,n} with prime(k)*prime(f(k)) - 2 prime for all k = 1,...,n.
If we let b(n) denote the number of even permutations f of {1,...,n} with prime(k)*prime(f(k)) - 2 prime for all k = 1,...,n, then (b(1),...,b(11)) = (1,1,1,1,3,6,1,1,33,125,226).
In 1973 J.-R. Chen proved that there are infinitely many primes p with p + 2 a product of at most two primes, such primes p are now called Chen primes.

Examples

			a(7) = 2. The only even permutation of {1,...,7} meeting the requirement is (1,5,7,4,2,6,3) with prime(1)*prime(1) - 2 = 2, prime(2)*prime(5) - 2 = 31, prime(3)*prime(7) - 2 = 83, prime(4)*prime(4) - 2 = 47, prime(5)*prime(2) - 2 = 31, prime(6)*prime(6) - 2 = 167 and prime(7)*prime(3) - 2 = 83 all prime. Also, the only odd permutation of {1,...,7} meeting the requirement is (1,5,7,6,2,4,3) with prime(1)*prime(1) - 2 = 2, prime(2)*prime(5) - 2 = 31, prime(3)*prime(7) - 2 = 83, prime(4)*prime(6) - 2 = 89, prime(5)*prime(2) - 2 = 31, prime(6)*prime(4) - 2 = 89 and prime(7)*prime(3) - 2 = 83 all prime.
		

Crossrefs

Programs

  • Mathematica
    Permanent[m_List]:=With[{v = Array[x, Length[m]]},Coefficient[Times @@ (m.v), Times @@ v]];
    a[n_]:=a[n]=Permanent[Table[Boole[PrimeQ[Prime[i]*Prime[j]-2]],{i,1,n},{j,1,n}]];
    Do[Print[n," ",a[n]],{n,1,27}]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, ispseudoprime(prime(i)*prime(j) - 2))); \\ Jinyuan Wang, Jun 13 2020

Extensions

a(28)-a(29) from Jinyuan Wang, Jun 13 2020
a(30)-a(36) from Vaclav Kotesovec, Aug 20 2021

A356187 Number of permutations f of {1,...,n} with f(1) = 1 such that those k*f(k) + 1 (k = 1..n) are n distinct primes.

Original entry on oeis.org

1, 1, 0, 0, 0, 2, 2, 6, 4, 24, 6, 162, 330, 1428, 1632
Offset: 1

Views

Author

Zhi-Wei Sun, Jul 28 2022

Keywords

Comments

Conjecture: a(n) > 0 except for n = 3,4,5. Also, for any integer n > 5, there is a permutation f of {1,...,n} with f(1) = 3 such that those k*f(k) - 1 (k = 1..n) are n distinct primes.
This is stronger than part (i) of the conjecture in A321597.

Examples

			a(7) = 2 since the only permutations f of {1,...,7} with f(1) = 1 such that {k*f(k) + 1: k = 1..7} is a set of 7 primes, are (f(1),...,f(7)) = (1,3,4,7,2,5,6) and (1,5,2,3,6,7,4). Note that 1*1 + 1 = 2, 2*3 + 1 = 7, 3*4 + 1 = 13, 4*7 + 1 = 29, 5*2 + 1 = 11, 6*5 + 1 = 31, 7*6+1 = 43 are distinct primes. Also, 1*1 + 1 = 2, 2*5 + 1 = 11, 3*2 + 1 = 7, 4*3 + 1 = 13, 5*6 + 1 = 31, 6*7 + 1 = 43, 7*4 + 1 = 29 are distinct primes.
a(10) > 0 since for (f(1),...,f(10)) = (1,3,4,7,8,5,6,9,2,10) the set {k*f(k) + 1: k = 1..10} is a set of 10 distinct primes.
		

Crossrefs

Programs

  • Mathematica
    (* A program to find all the permutations f of {1,...,9} with f(1) = 1 such that U = {k*f(k)+1: k = 1..9} is a set of 9 distinct primes. *)
    V[i_]:=V[i]=Part[Permutations[{2,3,4,5,6,7,8,9}],i]
    m=0;Do[U={2};Do[p=j*V[i][[j-1]]+1;If[PrimeQ[p],U=Append[U,p]],{j,2,9}];
    If[Length[Union[U]]==9,m=m+1;Print[m," ",V[i]," ",U]],{i,1,8!}]
  • Python
    from itertools import permutations as perm
    from itertools import islice
    from sympy import isprime
    from math import factorial as fact
    import collections
    def consume(iterator, n=None):
        "Advance the iterator n-steps ahead. If n is None, consume entirely."
        # Use functions that consume iterators at C speed.
        if n is None:
            # feed the entire iterator into a zero-length deque
            collections.deque(iterator, maxlen=0)
        else:
            # advance to the empty slice starting at position n
            next(islice(iterator, n, n), None)
    for x in range(2,20):
        mult = range(1,x)
        count = 0
        q = perm(range(1,x))
        for y in q:
            keeppos = 0
            keepflag = False
            if y[0] != 1:#stop when the first digit is not 1
                break
            z = [mult[a] * y[a] + 1 for a in range(x-1)]
            for b in z[0:-2]:
                if not isprime(b):
                    keeppos = z.index(b)
                    keepflag = True
                    break
            if keepflag:#skip ahead to advance the next non-prime term
                consume(q,fact(x-keeppos-2)-1)
            elif len(set(z)) == len(z) and all(isprime(b) for b in set(z)):#no duplicates and all primes
                count += 1
        print(x-1,count)
    # David Consiglio, Jr., Aug 04 2022

Extensions

a(11)-a(13) from Jinyuan Wang, Jul 29 2022
a(14)-a(15) from David Consiglio, Jr., Aug 04 2022

A321651 Number of even permutations f of {1,...,n} such that k^3 + f(k)^3 is a practical number for every k = 1,...,n.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 6, 24, 36, 180, 840
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 15 2018

Keywords

Comments

Conjecture 1: a(n) > 0 for all n > 0.
Conjecture 2: For any positive integer n, there is a permutation f of {1,...,n} such that k*f(k) is practical for every k = 1,...,n.
P. Bradley proved in arXiv:1809.01012 that for any positive integer n there is a permutation f of {1,...,n} such that all the numbers k + f(k) (k = 1,...,n) are prime. Modifying his proof slightly we see that for each n = 1,2,3,... there is a permutation f of {1,...,n} such that k + f(k) is practical for every k = 1,...,n.

Examples

			a(5) = 1, and (5,4,3,2,1) is an even permutation of {1,2,3,4,5} with 1^3 + 5^3 = 126, 2^3 + 4^3 = 72, 3^3 + 3^3 = 54, 4^3 + 2^3 = 72 and 5^3 + 1^3 = 126 all practical.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    Pow[n_, i_]:=Pow[n,i]=Part[Part[f[n], i], 1]^(Part[Part[f[n], i], 2]);
    Con[n_]:=Con[n]=Sum[If[Part[Part[f[n], s+1], 1]<=DivisorSigma[1, Product[Pow[n, i], {i, 1, s}]]+1, 0, 1], {s, 1, Length[f[n]]-1}];
    pr[n_]:=pr[n]=n>0&&(n<3||Mod[n, 2]+Con[n]==0);
    V[n_]:=V[n]=Permutations[Table[i,{i,1,n}]];
    Do[r=0;Do[If[Signature[Part[V[n],k]]==-1,Goto[aa]];Do[If[pr[i^3+Part[V[n],k][[i]]^3]==False,Goto[aa]],{i,1,n}];r=r+1;Label[aa],{k,1,n!}];Print[n," ",r],{n,1,11}]

A321766 Number of permutations f of {1,...,n} such that 3^k + 3^(f(k)) - 1 is prime for every k = 1,...,n.

Original entry on oeis.org

1, 2, 3, 11, 14, 33, 59, 290, 843, 690, 231, 978, 2896, 2966, 38252, 384917, 22351, 68546, 28245, 147459, 84578, 17647, 17647, 232213, 17647, 792, 93640, 785178, 5635699, 11658279, 67706584, 351837312, 233636388, 26967286, 35027435, 242576452
Offset: 1

Views

Author

Zhi-Wei Sun, Nov 18 2018

Keywords

Comments

Clearly, a(n) is the permanent of the matrix of order n whose (i,j)-entry is 1 or 0 according as 3^i + 3^j - 1 is prime or not.
Although the first 30 terms are positive, we have a(154) = 0 since it is easy to verify that 3^154 + 3^k - 1 is composite for every k = 1..154.
From Robert Israel, Dec 08 2019: (Start)
In fact 3^154 + 3^k - 1 is composite for k = 1..383, so a(n)=0 for 154 <= n <= 383.
Conjecture: for each n >= 154 there is m <= n such that 3^m + 3^k - 1 is composite for k = 1..n. This implies that a(n) = 0 for such n.
Conjecture verified for 154 <= n <= 2635. (End)
If we let b(n) denote the number of even permutations g of {1,...,n} with 3^k + 3^(g(k)) - 1 prime for all k = 1,...,n, then the values of b(1),b(2),...,b(11) are 1, 1, 1, 6, 8, 17, 30, 144, 422, 353, 111 respectively.
In the linked 2017 paper (see Conjecture 3.26), the author conjectured that for any integer a > 1 there are infinitely many primes of the form a^(2k) + a^m - 1 with k and m positive integers.

Examples

			a(2) = 2 since both (1,2) and (2,1) are permutations of {1,2}, and 3^1 + 3^1 - 1 = 5, 3^2 + 3^2 - 1 = 17, 3^1 + 3^2 - 1 = 11 and 3^2 + 3^1 - 1 = 11 are all prime.
		

Crossrefs

Programs

  • Maple
    N:= 25: # to get a(1)..a(N)
    q:= proc(i,j)  if isprime(3^i+3^j-1) then 1 else 0 fi end proc:
    M:= Matrix(N,N, q, shape=symmetric):
    seq(LinearAlgebra:-Permanent(M[1..n,1..n]), n=1..N); # Robert Israel, Dec 08 2019
  • Mathematica
    a[n_]:=a[n]=Permanent[Table[Boole[PrimeQ[3^i+3^j-1]],{i,1,n},{j,1,n}]];
    Do[Print[n," ",a[n]],{n,1,30}]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, ispseudoprime(3^i + 3^j - 1))); \\ Jinyuan Wang, Jun 13 2020

Extensions

a(31) from Jinyuan Wang, Jun 13 2020
a(32)-a(36) from Vaclav Kotesovec, Aug 18 2021
Showing 1-8 of 8 results.