login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers x whose trajectory reaches 1 under recursive applications of the map x -> x/3 if x == 0 (mod 3), x -> (4*x+2)/3 if x == 1 (mod 3), x -> (4*x+1)/3 if x == 2 (mod 3).
0

%I #23 Oct 12 2018 21:07:17

%S 1,2,3,4,6,9,12,13,18,20,27,29,36,39,40,54,60,65,81,87,108,109,117,

%T 120,121,136,146,162,180,182,195,197,243,245,261,263,272,324,327,328,

%U 332,351,360,363

%N Numbers x whose trajectory reaches 1 under recursive applications of the map x -> x/3 if x == 0 (mod 3), x -> (4*x+2)/3 if x == 1 (mod 3), x -> (4*x+1)/3 if x == 2 (mod 3).

%o (C++)

%o #include <iostream>

%o using namespace std;

%o void Number_Generator();

%o int main()

%o {

%o Number_Generator();

%o return 0;

%o }

%o void Number_Generator()

%o {

%o int Number_Tested=1; int Temporary;

%o int Divideby=3;

%o //For numbers bigger than this you need to use unsigned long int or do some large number implementation.

%o int Limit=38000;

%o while(Number_Tested<Limit)

%o {

%o Temporary=Number_Tested;

%o //There are two cycles. 1 and 7 are the smallest numbers in those cycles.

%o while((Temporary!=1) && (Temporary!=7))

%o {

%o if(Temporary%Divideby)

%o Temporary=(Temporary*(Divideby+1)+(Divideby-(Temporary%Divideby)))/Divideby;

%o else

%o Temporary=Temporary/Divideby;

%o }

%o if(Temporary==1)

%o cout<<Number_Tested<<"\n";

%o Number_Tested++;

%o }

%o }

%Y Cf. A014682, A126241, A138754.

%K nonn

%O 1,2

%A _Jack Warren_, Sep 02 2018