%I #23 Mar 04 2018 13:39:24
%S 8,1,1,2,1,3,50,4,3,5,78,6,92,7,5,8,120,9,134,10,7,11,162,12,5,13,9,
%T 14,204,15,218,16,11,17,7,18,260,19,13,20,288,21,302,22,15,23,330,24,
%U 344,25,17,26,372,27,11,28,19,29,414,30,428,31,21,32,13,33,470,34,23,35,498
%N Image of n under one application of the "7x+1" map.
%C The 7x+1 map sends x to x/2 if x is even, x/3 if x is odd and divisible by 3, x/5 if x is not divisible by 6 and divisible by 5, otherwise 7x+1.
%H Harvey P. Dale, <a href="/A133421/b133421.txt">Table of n, a(n) for n = 1..10000</a>
%H Tomás Oliveira e Silva, <a href="http://sweet.ua.pt/tos/3x+1.html">The px+1 problem</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F From _Chai Wah Wu_, Mar 04 2018: (Start)
%F a(n) = 2*a(n-30) - a(n-60) for n > 60.
%F G.f.: x*(6*x^58 + x^57 + x^56 + 2*x^55 + x^54 + 3*x^53 + 48*x^52 + 4*x^51 + 3*x^50 + 5*x^49 + 76*x^48 + 6*x^47 + 90*x^46 + 7*x^45 + 5*x^44 + 8*x^43 + 118*x^42 + 9*x^41 + 132*x^40 + 10*x^39 + 7*x^38 + 11*x^37 + 160*x^36 + 12*x^35 + 5*x^34 + 13*x^33 + 9*x^32 + 14*x^31 + 202*x^30 + 15*x^29 + 204*x^28 + 14*x^27 + 9*x^26 + 13*x^25 + 5*x^24 + 12*x^23 + 162*x^22 + 11*x^21 + 7*x^20 + 10*x^19 + 134*x^18 + 9*x^17 + 120*x^16 + 8*x^15 + 5*x^14 + 7*x^13 + 92*x^12 + 6*x^11 + 78*x^10 + 5*x^9 + 3*x^8 + 4*x^7 + 50*x^6 + 3*x^5 + x^4 + 2*x^3 + x^2 + x + 8)/(x^60 - 2*x^30 + 1). (End)
%t Table[Nest[Which[EvenQ[#],#/2,Divisible[#,3],#/3,Divisible[#,5],#/5, True, 7#+1]&,n,1],{n,75}] (* _Harvey P. Dale_, Nov 05 2011 *)
%o (PARI) a(n)=if(n%2,if(n%3,if(n%5,7*n+1,n/5),n/3),n/2) \\ _Charles R Greathouse IV_, Sep 02 2015
%o (Python)
%o from __future__ import division
%o def A133421(n):
%o return n//2 if not n % 2 else (n//3 if not n % 3 else (n//5 if not n % 5 else 7*n+1)) # _Chai Wah Wu_, Mar 04 2018
%Y Cf. A133422, A133419.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_, Nov 27 2007
%E More terms from _Sean A. Irvine_, Mar 29 2010
%E Comment clarified by _Chai Wah Wu_, Mar 04 2018
|