|
|
A094044
|
|
Alternate prime and nonprime numbers not included earlier such that every concatenation of a pair of terms is a prime: a(2n) is nonprime and a(2n-1) is prime.
|
|
3
|
|
|
2, 9, 7, 1, 3, 49, 19, 33, 13, 21, 11, 51, 47, 87, 31, 63, 17, 77, 23, 39, 29, 27, 41, 57, 37, 69, 59, 81, 61, 99, 67, 91, 73, 93, 43, 117, 79, 111, 71, 119, 53, 129, 83, 177, 89, 123, 113, 143, 107, 171, 103, 141, 97, 159, 157, 133, 109, 121, 139, 169, 151, 153, 137, 147
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
a(3)=7 => 97 is a prime but not necessarily 297 (in fact not a prime).
|
|
MAPLE
|
N:= 1000: # to get terms before the first term > N
P, C:= selectremove(isprime, [1, $3..N]):
dcat:= proc(x, y) 10^(1+ilog10(y))*x+y end proc:
A[1]:= 2:
for n from 2 do
if n::even then
for j from 1 to nops(C) do
if isprime(dcat(A[n-1], C[j])) then
A[n]:= C[j];
C:= subsop(j=NULL, C);
break
fi
od
else
for j from 1 to nops(P) do
if isprime(dcat(A[n-1], P[j])) then
A[n]:= P[j];
P:= subsop(j=NULL, P);
break
fi
od
fi;
if not assigned(A[n]) then break fi
od:
|
|
MATHEMATICA
|
p = Prime[ Range[ 500]]; np = Drop[ Complement[ Range[ 500], p], 1]; a[0] = 0; a[n_] := a[n] = Block[{k = 1, q = IntegerDigits[a[n - 1]]}, If[ OddQ[n], While[ !PrimeQ[ FromDigits[ Join[q, IntegerDigits[ p[[k]] ]]]], k++ ]; q = p[[k]]; p = Delete[p, k]; q, While[ !PrimeQ[ FromDigits[ Join[q, IntegerDigits[ np[[k]] ]]]], k++ ]; q = np[[k]]; np = Delete[np, k]; q]]; Table[ a[n], {n, 64}]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|