A291504 Number of permutations s_1,s_2,...,s_n of 1,2,...,n such that for all j=1,2,...,n, Sum_{i=1..j} s_i is not a prime.
1, 1, 0, 1, 3, 8, 48, 206, 1838, 13336, 133764, 1081556, 11046816, 108196128, 1555323224, 16279258144, 289771660328, 3495882548784, 66923393467216, 942785369844048, 15625264115770992, 315553823251866304, 5974132307015712032, 104979988889030774848
Offset: 0
Keywords
Examples
1 is not a prime, 1 + 3 is not a prime, 1 + 3 + 2 is not a prime, 1 + 3 + 2 + 4 is not a prime. So [1, 3, 2, 4] satisfies all the conditions. --------------------------------------------- a(1) = 1: [[1]]; a(3) = 1: [[1, 3, 2]]; a(4) = 3: [[1, 3, 2, 4], [1, 3, 4, 2], [4, 2, 3, 1]]; a(5) = 8: [[1, 3, 2, 4, 5], [1, 3, 4, 2, 5], [1, 5, 2, 4, 3], [1, 5, 4, 2, 3], [4, 2, 3, 1, 5], [4, 2, 3, 5, 1], [4, 5, 1, 2, 3], [4, 5, 3, 2, 1]].
Programs
-
Mathematica
Table[Count[Permutations@ Range@ n, ?(AllTrue[Accumulate@ #, ! PrimeQ@ # &] &)], {n, 0, 10}] (* _Michael De Vlieger, Aug 26 2017 *)
Extensions
a(0), a(12)-a(23) from Alois P. Heinz, Aug 25 2017