[go: up one dir, main page]

login
Search: a094045 -id:a094045
     Sort: relevance | references | number | modified | created      Format: long | short | data
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.
+10
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
OFFSET
1,1
COMMENTS
Conjecture: all members of A045572 are in the sequence. - Robert Israel, Oct 24 2017
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:
seq(A[i], i=1..n-1); # Robert Israel, Oct 24 2017
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
Robert G. Wilson v, Apr 23 2004
STATUS
approved
Alternate composite and prime numbers not included earlier such that every partial concatenation is a prime: a(2n) is prime and a(2n-1) is not prime.
+10
1
1, 3, 9, 13, 63, 107, 27, 67, 39, 23, 49, 29, 99, 439, 207, 41, 357, 229, 77, 139, 69, 839, 133, 239, 121, 317, 187, 53, 33, 1291, 177, 557, 171, 1753, 323, 19, 519, 953, 231, 523, 321, 251, 327, 31, 299, 2203, 747, 101, 81, 1741, 291, 6779, 261, 1549, 1463, 97, 297
OFFSET
1,2
COMMENTS
Conjecture: 2 and 5 are the only two nonmembers.
EXAMPLE
1, 13, 139, 13913, 1391363, 1391363107,..., etc. are not composite.
MATHEMATICA
p = Prime[ Range[ 1500]]; np = Drop[ Complement[ Range[ 1500], p], 1]; a[1] = 1; a[n_] := a[n] = Block[{k = 1, q = Flatten[ IntegerDigits[ # ] & /@ Table[ a[i], {i, n - 1}]]}, If[ EvenQ[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, 60}]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Apr 23 2004
STATUS
approved

Search completed in 0.007 seconds