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.

A353651 Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3, where k = 4.

This page as a plain text file.
%I A353651 #47 Jul 16 2022 11:56:53
%S A353651 2,3,7,8,9,10,11,15,19,23,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
%T A353651 41,42,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,108,109,
%U A353651 110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125
%N A353651 Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3, where k = 4.
%C A353651 Numbers m such that the base-4 representation of (3*m-1) starts with 11 or 12 or 13 or ends with 0.
%C A353651 First differences give a run of 4^i 1's followed by a run of 4^i 4's, for i = 0, 1, 2, ...
%H A353651 Yifan Xie, <a href="/A353651/b353651.txt">Table of n, a(n) for n = 1..10000</a>
%H A353651 <a href="/index/Aa#aan">Index entries for sequences of the a(a(n)) = 2n family</a>
%F A353651 For n in the range (2*4^i + 1)/3 < n <= (5*4^i + 1)/3, for i >= 0:
%F A353651   a(n) = n + 4^i.
%F A353651   a(n) = 1 + a(n-1).
%F A353651 Otherwise, for n in the range (5*4^i + 1)/3 < n <= (8*4^i + 1)/3, for i >= 0:
%F A353651   a(n) = 4*(n - 4^i) - 1.
%F A353651   a(n) = 4 + a(n-1).
%e A353651 a(6) = 10 because (2*4^1 + 1)/3 < 6 <= (5*4^1 + 1)/3, hence a(6) = 6 + 4^1 = 10;
%e A353651 a(9) = 19 because (5*4^1 + 1)/3 < 9 <= (8*4^1 + 1)/3, hence a(9) = 4*(9 - 4^1) - 1 = 19.
%p A353651 isA353651 := proc(n)
%p A353651     if modp(n,4) = 3 then
%p A353651         true;
%p A353651     else
%p A353651         b4 := convert(3*n-1,base,4) ;
%p A353651         if op(-1,b4) = 1 and op(-2,b4) <> 0  then
%p A353651             true ;
%p A353651         else
%p A353651             false;
%p A353651         end if;
%p A353651     end if;
%p A353651 end proc:
%p A353651 for n from 2 to 122 do
%p A353651     if isA353651(n) then
%p A353651         printf("%d,",n) ;
%p A353651     end if;
%p A353651 end do: # _R. J. Mathar_, Jul 05 2022
%o A353651 (PARI) a(n) = my(n3=3*n, s=logint(n3>>1, 4)<<1); if(n3>>s < 5, n + 1<<s, 4*(n - 1<<s) - 1); \\ _Kevin Ryde_, Apr 15 2022
%o A353651 (C++)
%o A353651 /* program used to generate the b-file */
%o A353651 #include<iostream>
%o A353651 using namespace std;
%o A353651 int main(){
%o A353651     int cnt1=1, flag=0, cnt2=1, a=2;
%o A353651     for(int n=1; n<=10000; n++) {
%o A353651         cout<<n<<" "<<a<<endl;
%o A353651         if(cnt2==cnt1) {
%o A353651             flag=1-flag, cnt1=1;
%o A353651             if(flag) a+=1;
%o A353651             else {
%o A353651                 a+=4;
%o A353651                 cnt2*=4;
%o A353651             }
%o A353651         }
%o A353651         else {
%o A353651             cnt1++;
%o A353651             a+=(flag?4:1);
%o A353651         }
%o A353651     }
%o A353651     return 0;
%o A353651 }
%Y A353651 For other values of k: A080637 (k=2), A003605 (k=3), this sequence (k=4), A353652 (k=5), A353653 (k=6).
%K A353651 nonn,easy
%O A353651 1,1
%A A353651 _Yifan Xie_, May 02 2022