login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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.
10
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,2
COMMENTS
See A219110 for the numbers which do not occur in this sequence. See A219250 for the analog when "sum" is replaced with "absolute difference", and A219248-A219251 for related sequences. - M. F. Hasler, Apr 11 2013
EXAMPLE
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.
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 *)
PROG
(PARI) A182178_vec={(n, a=[1], u=0)->while(#a<n, u+=1<<a[#a]; for(t=a[1]+1, 9e9, bittest(u, t)&next; my(d=concat(a[#a]%10, digits(t))); for(i=2, #d, isprime(d[i-1]+d[i])||next(2)); a=concat(a, t); break)); a} \\ M. F. Hasler, Apr 11 2013
CROSSREFS
Sequence in context: A332212 A085161 A085162 * A326316 A361444 A305417
KEYWORD
nonn,base,easy
AUTHOR
Jim Nastos and Eric Angelini, Apr 16 2012
STATUS
approved