login
Group the natural numbers such that the n-th group contains n terms and the group sum is the smallest possible prime.
6

%I #31 Feb 11 2023 08:13:34

%S 2,1,4,3,5,9,6,7,8,10,11,12,13,14,17,15,16,18,19,20,21,22,23,24,25,26,

%T 27,32,28,29,30,31,33,34,35,37,36,38,39,40,41,42,43,44,50,45,46,47,48,

%U 49,51,52,53,54,58,55,56,57,59,60,61,62,63,64,65,71,66,67,68,69,70,72

%N Group the natural numbers such that the n-th group contains n terms and the group sum is the smallest possible prime.

%C Row sums (the primes) are in A075345. In case there is more than one way to write the given prime, e.g., A075345(3) = 3+5+9 = 3+6+8, the lexicographically smallest is to be chosen, here (3,5,9) rather than (3,6,8). - _M. F. Hasler_, Sep 26 2015

%C The flattened triangle is a permutation of the positive integers with inverse = A262663 and fixed points A262665.

%H Reinhard Zumkeller, <a href="/A075348/b075348.txt">Rows n = 1..100 of triangle, flattened</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F T(n,1)=A075346(n); T(n,n)=A075347(n); A075344(n) = Sum_{k=1..n} T(n,k). - _Reinhard Zumkeller_, Sep 26 2015

%e Triangle starts:

%e 2;

%e 1, 4;

%e 3, 5, 9;

%e 6, 7, 8, 10;

%e 11, 12, 13, 14, 17;

%e 15, 16, 18, 19, 20, 21;

%e ...

%o (Haskell)

%o import Data.List ((\\))

%o a075348 n k = a075348_tabl !! (n-1) !! (k-1)

%o a075348_row n = a075348_tabl !! (n-1)

%o a075348_tabl = f 0 [1..] where

%o f x zs = (us ++ [y]) : f (x + 1) (zs \\ (y : us)) where

%o y = g vs

%o g (w:ws) = if a010051' (sum us + w) == 1 then w else g ws

%o (us, vs) = splitAt x zs

%o a075348_list = concat a075348_tabl

%o -- _Reinhard Zumkeller_, Sep 26 2015

%Y Cf. A075345, A075346, A075347.

%Y Cf. A262663 (inverse), A262665 (fixed points).

%K nonn,tabl

%O 1,1

%A _Amarnath Murthy_, Sep 19 2002

%E Extended by _Ray Chandler_, Apr 09 2014

%E Name changed by _M. F. Hasler_, Sep 26 2015