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!)
A118256 Concatenation for i=1 to n of A005171(i); also A118255 in base 2. 8

%I #28 Jan 10 2022 08:31:57

%S 1,10,100,1001,10010,100101,1001010,10010101,100101011,1001010111,

%T 10010101110,100101011101,1001010111010,10010101110101,

%U 100101011101011,1001010111010111,10010101110101110,100101011101011101,1001010111010111010,10010101110101110101,100101011101011101011

%N Concatenation for i=1 to n of A005171(i); also A118255 in base 2.

%H Michael S. Branicky, <a href="/A118256/b118256.txt">Table of n, a(n) for n = 1..1000</a> (terms 1..30 from N. J. A. Sloane)

%F a(n) ~ 10^n * 0.10010101.... [_Charles R Greathouse IV_, Dec 27 2011]

%e A005171 : 1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1 ................

%e a(1)=1, a(2)=10, a(3)=100, a(4)=1001, ...

%t Array[FromDigits@ Array[Boole[! PrimeQ@ #] &, #] &, 21] (* or *)

%t FromDigits@ IntegerDigits[#, 2] & /@ Last@ Transpose@ NestList[{#1 + 1, If[PrimeQ[#1 + 1], 2 #2, 2 #2 + 1]} & @@ # &, {1, 1}, 21] (* _Michael De Vlieger_, Nov 01 2016, latter after _Harvey P. Dale_ at A118255 *)

%o (PARI) a(n) = sum(k=1, n, !isprime(k)*10^(n-k)); \\ _Michel Marcus_, Nov 01 2016

%o (Python)

%o from sympy import isprime

%o def a(n): return int("".join(str(1-isprime(i)) for i in range(1, n+1)))

%o print([a(n) for n in range(1, 22)]) # _Michael S. Branicky_, Jan 10 2022

%o (Python) # faster version for initial segment of sequence

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o an = 0

%o for k in count(1):

%o an = 10 * an + int(not isprime(k))

%o yield an

%o print(list(islice(agen(), 21))) # _Michael S. Branicky_, Jan 10 2022

%Y Cf. A005171, A118255, A118257.

%K nonn,base,easy

%O 1,2

%A _Pierre CAMI_, Apr 19 2006

%E Corrected by _Omar E. Pol_, Nov 08 2007

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 26 03:00 EDT 2024. Contains 375454 sequences. (Running on oeis4.)