A330402 Lexicographically earliest sequence of distinct positive terms with an associate sequence t such that t(0) = 0, and for any n > 0, at least one of t(n-1) - a(n) or t(n-1) + a(n) is a prime number; in case t(n-1) - a(n) is a prime number, set t(n) = t(n-1) - a(n), otherwise set t(n) = t(n-1) + a(n).
2, 1, 4, 5, 3, 6, 8, 10, 11, 9, 12, 14, 16, 18, 24, 20, 22, 28, 30, 26, 32, 34, 38, 36, 42, 40, 46, 44, 50, 45, 15, 54, 48, 21, 17, 52, 56, 60, 62, 66, 58, 70, 64, 78, 68, 27, 29, 72, 74, 80, 82, 84, 76, 96, 86, 39, 35, 90, 98, 102, 88, 41, 51, 104, 94, 100
Offset: 1
Keywords
Examples
The first terms, alongside t(n), are: n a(n) t(n) -- ---- ---- 0 N/A 0 1 2 2 2 1 3 3 4 7 4 5 2 5 3 5 6 6 11 7 8 3 8 10 13 9 11 2 10 9 11 11 12 23 12 14 37
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program for A330402
Programs
-
PARI
See Links section.
Comments