|
|
A078431
|
|
Number of permutations p of 1,2,...,n such that both numerator and denominator of the continued fraction [p(1); p(2),...,p(n)] are primes.
|
|
3
|
|
|
0, 1, 1, 3, 3, 20, 126, 694, 2874, 25059, 218517, 2054986, 21050226
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
a(4)=3 because [2;1,3,4] = 47/17, [2;3,1,4] = 43/19, [4;3,1,2] = 47/11.
|
|
MATHEMATICA
|
Table[Length@Select[Permutations@Range@n, And@@PrimeQ[{Denominator@#, Numerator@#}&@FromContinuedFraction@#]&], {n, 9}] (* Giorgos Kalogeropoulos, Sep 22 2021 *)
|
|
PROG
|
(Python)
from itertools import permutations
from sympy import isprime
from sympy.ntheory.continued_fraction import continued_fraction_reduce
def A078431(n): return sum(1 for p in permutations(range(1, n+1)) if (lambda x: isprime(x.p) and isprime(x.q))(continued_fraction_reduce(p))) # Chai Wah Wu, Sep 22 2021
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|