login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 30 00:57 EDT 2024. Contains 375520 sequences. (Running on oeis4.)