login
A078433
Number of permutations p of 1,2,...,n such that the numerator of the continued fraction [p(1); p(2),...,p(n)] is prime.
3
0, 2, 2, 10, 30, 124, 992, 5700, 39844, 366172, 3587856, 38861778, 435816838
OFFSET
1,2
MATHEMATICA
Table[Length@Select[Permutations@Range@n, PrimeQ@Numerator@FromContinuedFraction@#&], {n, 9}] (* Giorgos Kalogeropoulos, Sep 22 2021 *)
PROG
(PARI) a(n)=sum(i=1, n!, isprime(contfracpnqn(numtoperm(n, i))[1, 1]))
(Python)
from itertools import permutations
from sympy import isprime
from sympy.ntheory.continued_fraction import continued_fraction_reduce
def A078433(n): return sum(1 for p in permutations(range(1, n+1)) if isprime(continued_fraction_reduce(p).p)) # Chai Wah Wu, Sep 22 2021
CROSSREFS
Sequence in context: A200949 A001885 A300641 * A059494 A052647 A326983
KEYWORD
nonn,more
AUTHOR
Reiner Martin, Dec 30 2002
EXTENSIONS
a(10)-a(11) from Robert Gerbicz, Nov 21 2010
a(12)-a(13) from Robert Gerbicz, Nov 27 2010
STATUS
approved