login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
Based on a question from Leroy Quet.
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
Sequence in context: A157050 A059368 A090694 * A346750 A292953 A292221
KEYWORD
nonn,more
AUTHOR
Reiner Martin, Dec 30 2002
EXTENSIONS
a(11)-a(13) from Robert Gerbicz, Nov 27 2010
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 06:56 EDT 2024. Contains 370953 sequences. (Running on oeis4.)