Gilbreath's Conjecture

Mathematica, 66 bytes

(For[z=1,Last@Nest[Abs@*Differences,Array[Prime,z+#],#]<3,z++];z)&

Pure function taking a positive integer as argument and returning a 1-indexed integer. Nest[Abs@*Differences,Array[Prime,z+#],#] computes the #th iterated absolute difference list of the list of the first z+# primes. For[z=1,Last@...<3,z++] loops this computation until the last element of the resulting list is at least 3, and then z is output. (Note that the correctness of the algorithm assumes Gilbreath's conjecture!)


Pyth, 32 bytes

-l.W>3h.WtHaVZtZ>QH+ZfP_TheZ.fP_

Try it online!

Uses 2-indexing.


MATL, 18 bytes

`@:YqG:"d|]3<A}@G-

Input and output are 1-based. It takes less than 40 seconds in TIO for each of the test cases.

Try it online!

Explanation

This keeps trying longer initial sequences of primes until the iterated absolute consecutive differences give at least one value exceeding 2.

`        % Do... while loop
  @:Yq   %   Array of first k primes, where k is iteration index
  G:"    %   Do this as many times as the input
    d|   %     Absolute value of consecutive differences
  ]      %   End
  3<A    %   Are they all less than 3? This is the loop condition
}        % Finally (execute before exiting loop)
  @G-    %   Push last iteration index minus input. This is the output
         % End (implicit). Continue with next iteration if top of stack is true
         % Display (implicit)