Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #19 Aug 06 2022 08:07:22
%S 1,1,0,0,0,2,2,6,4,24,6,162,330,1428,1632
%N 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.
%C 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.
%C This is stronger than part (i) of the conjecture in A321597.
%H Zhi-Wei Sun, <a href="https://doi.org/10.1007/s10801-021-01028-8">On permutations of {1,...,n} and related topics</a>, J. Algebraic Combin., 2021.
%e 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.
%e 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.
%t (* 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. *)
%t V[i_]:=V[i]=Part[Permutations[{2,3,4,5,6,7,8,9}],i]
%t m=0;Do[U={2};Do[p=j*V[i][[j-1]]+1;If[PrimeQ[p],U=Append[U,p]],{j,2,9}];
%t If[Length[Union[U]]==9,m=m+1;Print[m," ",V[i]," ",U]],{i,1,8!}]
%o (Python)
%o from itertools import permutations as perm
%o from itertools import islice
%o from sympy import isprime
%o from math import factorial as fact
%o import collections
%o def consume(iterator, n=None):
%o "Advance the iterator n-steps ahead. If n is None, consume entirely."
%o # Use functions that consume iterators at C speed.
%o if n is None:
%o # feed the entire iterator into a zero-length deque
%o collections.deque(iterator, maxlen=0)
%o else:
%o # advance to the empty slice starting at position n
%o next(islice(iterator, n, n), None)
%o for x in range(2,20):
%o mult = range(1,x)
%o count = 0
%o q = perm(range(1,x))
%o for y in q:
%o keeppos = 0
%o keepflag = False
%o if y[0] != 1:#stop when the first digit is not 1
%o break
%o z = [mult[a] * y[a] + 1 for a in range(x-1)]
%o for b in z[0:-2]:
%o if not isprime(b):
%o keeppos = z.index(b)
%o keepflag = True
%o break
%o if keepflag:#skip ahead to advance the next non-prime term
%o consume(q,fact(x-keeppos-2)-1)
%o elif len(set(z)) == len(z) and all(isprime(b) for b in set(z)):#no duplicates and all primes
%o count += 1
%o print(x-1,count)
%o # _David Consiglio, Jr._, Aug 04 2022
%Y Cf. A000040, A321597, A333083.
%K nonn,more
%O 1,6
%A _Zhi-Wei Sun_, Jul 28 2022
%E a(11)-a(13) from _Jinyuan Wang_, Jul 29 2022
%E a(14)-a(15) from _David Consiglio, Jr._, Aug 04 2022