login
A309059
a(1) = 1; for n > 1, a(n) = 2 if the concatenation of all the previous terms is prime and a(n) = 1 otherwise.
2
1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
OFFSET
1,3
COMMENTS
Does this sequence contain an infinite number of 2s?
LINKS
Sean A. Irvine, Java program (github)
EXAMPLE
For n = 2, the concatenation of the previous terms is 1, which is not prime, so a(2) = 1.
For n = 3, the concatenation of the previous terms is 11, which is prime, so a(3) = 2.
For n = 4, the concatenation of the previous terms is 112 = 2^4 * 7, which is clearly not prime, so a(4) = 1.
MAPLE
A[1]:= 1; x:= 1;
for i from 2 to 100 do
if isprime(x) then A[i]:= 2; x:= 10*x+2;
else A[i]:= 1; x:= 10*x+1
fi
od:
seq(A[i], i=1..100); # Robert Israel, Dec 03 2019
MATHEMATICA
IntegerDigits[NestList[10# + If[PrimeQ[#], 2, 1] &, 1, 80][[-1]]] (* Alonso del Arte, Jul 13 2019 *)
CROSSREFS
Sequence in context: A083894 A128257 A198254 * A368712 A293630 A305393
KEYWORD
nonn,base
AUTHOR
Eric Joseph Brignac, Jul 09 2019
STATUS
approved