%I #24 Nov 08 2021 18:00:31
%S 1,1,1,1,2,2,8,8,22,104,1128,1128,14520,14520,229734,3217088
%N Number of permutations p from (1,2,3,...,n) to (1,2,3...,n) such that 1/p(1)+2/p(2)+...+n/p(n) is an integer.
%F For each prime p: a(p) = a(p-1). - _Alois P. Heinz_, Nov 08 2021
%e p(1,2)=(1,2) is the only permutation such that 1/p(1)+2/p(2) is an integer hence a(2)=1.
%e a(4) = 2: 1234, 2431.
%e a(5) = 2: 12345, 24315.
%e a(6) = 8: 123456, 146253, 216453, 243156, 312654, 342651, 621354, 641352.
%e a(7) = 8: 1234567, 1462537, 2164537, 2431567, 3126547, 3426517, 6213547, 6413527.
%o (PARI) a(n)=if(n<0,0,sum(k=1,n!,if(frac(sum(i=1,n,i/component(numtoperm(n,k),i))),0,1)))
%Y Cf. A000040.
%K nonn,more
%O 0,5
%A _Benoit Cloitre_, Aug 18 2002
%E More terms from _John W. Layman_, Feb 06 2004
%E Corrected by _Benoit Cloitre_, Feb 21 2004
%E a(14)-a(15) from _Matthijs Coster_, Mar 22 2017
%E a(0)=1 prepended by _Alois P. Heinz_, Nov 08 2021
|