%I #29 Oct 31 2023 07:01:00
%S 2,1,1,1,2,1,2,1,4,1,2,1,4,1,2,1,4,1,6,1,2,1,6,1,4,1,2,1,4,1,6,1,6,1,
%T 2,1,6,1,4,1,2,1,6,1,4,1,6,1,8,1,4,1,2,1,4,1,2,1,4,1,14,1,4,1,6,1,2,1,
%U 10,1,2,1,6,1,6,1,4,1,6,1,6,1,2,1,10,1,2,1
%N A054541 and A000012 interleaved.
%C a(n) is also the length of the n-th edge of a staircase which represents the function pi(x) on the first quadrant of the square grid, see A000720.
%C a(2n-1) is the length of the n-th horizontal edge in the staircase.
%C a(2n) is the length of the n-th vertical edge in the staircase.
%C For another version see A230849.
%H Antti Karttunen, <a href="/A230850/b230850.txt">Table of n, a(n) for n = 1..10000</a>
%F a(1) = 2; for n > 1, a(n) = A230849(n). - _Antti Karttunen_, Dec 23 2018
%e Illustration of initial terms, n = 1..22:
%e .
%e 1 _ _|
%e 1 _ _ _ _ _ _|
%e 1 _ _ _ _|
%e 1 _ _|
%e 1 _ _ _ _|
%e 1 _ _|
%e 1 _ _ _ _|
%e 1 _ _|
%e 1 _ _|
%e 1 _|
%e 1 _ _|
%e .
%e . 2 1 2 2 4 2 4 2 4 6 2
%e .
%e Drawing vertical line segments below the staircase (as shown below) we have that the number of cells in the vertical bars gives 0 together A000720.
%e Drawing horizontal line segments above the staircase we have that the number of cells in the k-th horizontal bar is A000040(k).
%e . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
%e 31 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
%e 29 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | |
%e 23 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | |
%e 19 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | |
%e 17 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | |
%e 13 |_ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | |
%e 11 |_ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | |
%e 7 |_ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | |
%e 5 |_ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | |
%e 3 |_ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
%e 2 |_ _|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
%e .
%e . 0 0 1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 10 10
%e .
%t Riffle[Join[{2},Differences[Prime[Range[100]]]],1] (* _Paolo Xausa_, Oct 31 2023 *)
%o (PARI) A230850(n) = if(1==n,2,if((n%2),prime((n+1)/2)-prime(((n+1)/2)-1),1)); \\ _Antti Karttunen_, Dec 23 2018
%Y Cf. A000012, A000040, A000720, A001223, A007504, A046992, A054541, A141042, A152535, A182986, A230849.
%K nonn
%O 1,1
%A _Omar E. Pol_, Oct 31 2013
|