%I #16 Aug 09 2022 05:41:14
%S 0,1,9,10,14,15,16,20,21,22,26,27,28,32,33,34,35,36,40,44,45,46,50,51,
%T 52,56,57,58,62,63,64,65,66,70,74,75,76,77,78,82,86,87,88,92,93,94,95,
%U 96,100,104,105,106,110,111,112,116,117,118,119,120,121,122,123,124,125
%N Least increasing sequence of nonprimes whose first differences are also nonprime.
%C The sequence of first differences contains only 1's and 4's (with an 8 at the beginning): 1 8 1 4 1 1 4 1 1 4 1 1 4 1 1 1 1 4 4 1 1 4 1 1 4 1 1 4 1 1 1 1 4 4 1 1 1 1 4 4 1 1 4 1 1 1 1 4 4
%e Begin with a(1)=0. Add to a(1) the least nonprime giving a nonprime number: + 1 = 1 for a(2). Now add to a(2) the least nonprime giving a composite: + 8 = 9 for a(3). Same rule: + 1 = 10 for a(4). Same rule: + 4 = 14 etc...
%t f[s_List] := Block[{j = s[[ -1]]}, k = j + 1; While[PrimeQ[k] || PrimeQ[k - j], k++ ]; Append[s, k]]; Nest[f, {0}, 64] (* _Robert G. Wilson v_, Sep 23 2006 *)
%o (PARI) lista(nn) = my(va = vector(nn), last=0); for (n=2, nn, my(new = last+1); while(isprime(new) || isprime(new-last), new++); va[n] = new; last = new;); va; \\ _Michel Marcus_, Aug 09 2022
%Y Cf. A109888, A110194 (first differences).
%K easy,nonn
%O 1,3
%A _Alexandre Wajnberg_ and _Eric Angelini_, Sep 04 2005
%E Extended by _Ray Chandler_, Sep 06 2005
|