[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
1
1, 1, 0, 0, 0, 2, 2, 6, 4, 24, 6, 162, 330, 1428, 1632
OFFSET
1,6
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.
LINKS
EXAMPLE
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.
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!}]
PROG
(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
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Zhi-Wei Sun, Jul 28 2022
EXTENSIONS
a(11)-a(13) from Jinyuan Wang, Jul 29 2022
a(14)-a(15) from David Consiglio, Jr., Aug 04 2022
STATUS
approved