%I #14 Oct 30 2022 18:19:59
%S 0,1,4,14,32,204,994,7526,48636,421392,4018976,41304726,490878388
%N Number of permutations p of 1,2,...,n such that the denominator of the continued fraction [p(1); p(2),...,p(n)] is prime.
%t Table[Length@Select[Permutations@Range@n,PrimeQ@Denominator@FromContinuedFraction@#&],{n,9}] (* _Giorgos Kalogeropoulos_, Sep 22 2021 *)
%o (Python)
%o from itertools import permutations
%o from sympy import isprime
%o from sympy.ntheory.continued_fraction import continued_fraction_reduce
%o def A078432(n): return sum(1 for p in permutations(range(1,n+1)) if isprime(continued_fraction_reduce(p).q)) # _Chai Wah Wu_, Sep 22 2021
%Y Cf. A078431, A078433.
%K nonn,more
%O 1,3
%A _Reiner Martin_, Dec 30 2002
%E a(10)-a(13) from _Robert Gerbicz_, Nov 27 2010
|