cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A087165 a(n)=1 when n == 1 (mod 4), otherwise a(n) = a(n - ceiling(n/4)) + 1. Removing all the 1's results in the original sequence with every term incremented by 1.

This page as a plain text file.
%I A087165 #20 Sep 23 2022 10:17:02
%S A087165 1,2,3,4,1,5,2,6,1,3,7,2,1,4,8,3,1,2,5,9,1,4,2,3,1,6,10,2,1,5,3,4,1,2,
%T A087165 7,11,1,3,2,6,1,4,5,2,1,3,8,12,1,2,4,3,1,7,2,5,1,6,3,2,1,4,9,13,1,2,3,
%U A087165 5,1,4,2,8,1,3,6,2,1,7,4,3,1,2,5,10,1,14,2,3,1,4,6,2,1,5,3,9,1,2,4,7,1,3,2
%N A087165 a(n)=1 when n == 1 (mod 4), otherwise a(n) = a(n - ceiling(n/4)) + 1. Removing all the 1's results in the original sequence with every term incremented by 1.
%C A087165 Indices of records are given by A087192: a(A087192(n))=n, where A087192(n) = ceiling(A087192(n-1)*4/3).
%C A087165 From _Benoit Cloitre_, Mar 07 2009: (Start)
%C A087165 To construct the sequence:
%C A087165 Step 1: start from a sequence of 1's, leaving 3 undefined places between 1's, giving 1,(),(),(),1,(),(),(),1,(),(),(),1,(),(),(),1,(),(),(),1,...
%C A087165 Step 2: replace the first undefined place with a 2 and leave 3 undefined places between 2's, giving 1,2,(),(),1,(),2,(),1,(),(),2,1,(),(),(),1,2,(),(),1,...
%C A087165 Step 3: replace the first undefined place with a 3 and leave 3 undefined places between 3's, giving 1,2,3,(),1,(),2,(),1,3,(),2,1,(),(),3,1,2,(),(),1,...
%C A087165 Step 4: replace the first undefined place with a 4 and leave 3 undefined places between 4's, giving 1,2,3,4,1,(),2,(),1,3,(),2,1,4,(),3,1,2,(),(),1,...
%C A087165 Iterating the process indefinitely yields the sequence: 1,2,3,4,1,5,2,6,1,3,7,2,1,4,8,3,1,2,5,9,1,... (End)
%F A087165 a(n) = 4 + A244041(4*(n-1)) - A244041(4*n). - _Tom Edgar_ and _James Van Alstine_, Aug 05 2014
%F A087165 a(4*n) = a(3*n)+1.
%F A087165 a(4*n+1) = 1.
%F A087165 a(4*n+2) = a(3*n+1)+1.
%F A087165 a(4*n+3) = a(3*n+2)+1. - _Robert Israel_, Aug 05 2014
%F A087165 a(n) < k*log(n) + 4 for n > 1 where k = 1/log(4/3) < 3.5. - _Charles R Greathouse IV_, Sep 22 2022
%p A087165 for n from 1 to 100 do
%p A087165   if n mod 4 = 1 then A[n]:= 1
%p A087165   else A[n]:= A[n - ceil(n/4)] + 1
%p A087165   fi
%p A087165 od:
%p A087165 seq(A[n],n=1..100); # _Robert Israel_, Aug 05 2014
%o A087165 (PARI) a(n)=my(s); while(n>4, if(n%4==1, return(s+1)); n=(n\4*3)+max(n%4 - 1,0); s++); s+n \\ _Charles R Greathouse IV_, Sep 22 2022
%Y A087165 Cf. A001511, A087088, A087192, A244041.
%Y A087165 a(n+1) - a(n) = 4*A018902(n-3), n > 2.
%K A087165 nonn,easy
%O A087165 1,2
%A A087165 _Paul D. Hanna_, Aug 24 2003