A182178 Beginning with 1, smallest positive integer not yet in the sequence such that two adjacent digits of the sequence (also ignoring commas between terms) sum to a prime.
1, 2, 3, 4, 7, 6, 5, 8, 9, 20, 21, 11, 12, 14, 16, 50, 23, 25, 29, 41, 43, 47, 49, 83, 85, 61, 65, 67, 411, 111, 112, 30, 32, 34, 38, 52, 56, 58, 92, 94, 70, 74, 76, 114, 98, 302, 116, 120, 202, 121, 123, 89, 203, 205, 207, 412, 125, 211, 129, 212, 141, 143
Offset: 1
Examples
20 follows 9 since 9+2 and 2+0 is prime, and no number less than 20 (not already in the sequence) satisfies the stated property.
Links
- Zak Seidov, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[1] = 1; a[n_] := a[n] = For[id = IntegerDigits[a[n-1]]; k = 1, True, k++, If[FreeQ[Array[a, n-1], k], dd = Join[id, IntegerDigits[k]]; If[And @@ PrimeQ /@ Plus @@@ Transpose[{Most[dd], Rest[dd]}], Return[k]]]]; Array[a, 62] (* Jean-François Alcover, Apr 17 2013 *)
-
PARI
A182178_vec={(n, a=[1], u=0)->while(#a
M. F. Hasler, Apr 11 2013
Comments