A253074 Lexicographically earliest sequence of distinct numbers such that a(n-1)+a(n) is not prime.
0, 1, 3, 5, 4, 2, 6, 8, 7, 9, 11, 10, 12, 13, 14, 16, 17, 15, 18, 20, 19, 21, 23, 22, 24, 25, 26, 28, 27, 29, 31, 32, 30, 33, 35, 34, 36, 38, 37, 39, 41, 40, 42, 43, 44, 46, 45, 47, 48, 50, 49, 51, 53, 52, 54, 56, 55, 57, 58, 59, 60, 61, 62, 63, 65, 64, 66
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a253074 n = a253074_list !! (n-1) a253074_list = 0 : f 0 [1..] where f u vs = g vs where g (w:ws) | a010051' (u + w) == 1 = g ws | otherwise = w : f w (delete w vs) -- Reinhard Zumkeller, Feb 02 2015
-
PARI
A253074_upto(n=99, a, u, U)={vector(n,n, for(k=u,oo, bittest(U,k-u)|| isprime(a+k)||[a=k,break]); (a>u && U+=1<<(a-u))|| U>>=-u+u+=valuation(U+2,2); a)+if(default(debug),print([u]))} \\ additional args allow to tweak computation. If debug > 0, print least unused number at the end. - M. F. Hasler, Nov 25 2019
Comments