A330434 a(1) = 1, a(2) = 2; thereafter a(n) = smallest number not occurring earlier such that the sum of three successive digits is prime.
1, 2, 4, 5, 8, 6, 3, 20, 9, 22, 7, 24, 10, 11, 13, 17, 31, 15, 51, 19, 35, 33, 53, 37, 39, 55, 71, 57, 73, 77, 91, 75, 59, 95, 93, 79, 110, 12, 21, 28, 14, 25, 42, 18, 23, 26, 32, 27, 40, 16, 41, 60, 50, 29, 62, 30, 43, 44, 34, 45, 48, 54, 49, 46, 38, 63, 80, 52, 47, 64, 36, 83, 68, 56, 61, 66, 58, 65, 84, 70, 67, 401
Offset: 1
Examples
After 8 and 6 the next term is 3 as 8+6+3 = 17 is a prime; After 6 and 3 the next term is 20 as 6+3+2 = 11 and 3+2+0 = 5 are primes; After 20 the next term is 9 as 2+0+9 = 11 is a prime; etc.
Links
- Carole Dubois, Table of n, a(n) for n = 1..508
Crossrefs
Programs
-
Mathematica
Nest[Append[#, Block[{k = 3}, While[Nand[FreeQ[#, k], AllTrue[Table[Total@ #[[i ;; i + 2]], {i, Length@ # - 2}], PrimeQ] &@ Flatten@ IntegerDigits@ Append[#, k] ], k++]; k]] &, {1, 2}, 80] (* Michael De Vlieger, Dec 14 2019 *)