OFFSET
1,3
COMMENTS
Does this sequence contain an infinite number of 2s?
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn,base
AUTHOR
Eric Joseph Brignac, Jul 09 2019
STATUS
approved