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.

A116640 a(n) = A116623(A059893(n)).

This page as a plain text file.
%I A116640 #43 Jul 09 2025 04:25:51
%S A116640 1,5,7,19,11,23,29,65,19,31,37,73,49,85,103,211,35,47,53,89,65,101,
%T A116640 119,227,89,125,143,251,179,287,341,665,67,79,85,121,97,133,151,259,
%U A116640 121,157,175,283,211,319,373,697,169,205,223,331,259,367,421,745,331
%N A116640 a(n) = A116623(A059893(n)).
%C A116640 Viewed as a binary tree, this is (1); 5; 7,19; 11,23,29,65; ... Cf. A116623.
%C A116640 If we treat (2n+1) as a binary number with the nonzero bits numbered (highest bit first) from 0..k and the regular binary place value of each nonzero bit numbered from b(0) to b(k) then a(n) = 3^0 * b(0) + 3^1 * b(1) + .. + 3^k. For instance, if n=6 then 2n+1 = 13, which is equal to 8+4+1 or 1101 base(2); and a(n)=29 which is 8*1 + 4*3 + 1*9. - _Joe Slater_, Jan 23 2016
%H A116640 Robert Israel, <a href="/A116640/b116640.txt">Table of n, a(n) for n = 0..10000</a>
%H A116640 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F A116640 a(A000225(n)) = A001047(n+1).
%F A116640 For n>= 1 a(A000079(n)) = A062709(n+1).
%F A116640 From _Joe Slater_, Jan 19 2016: (Start)
%F A116640 a(0) = 1,
%F A116640 a(n) = 3*a(floor(n/2)) - 2*a(floor(n/4)) for n=0 (mod 4) and n>0,
%F A116640 a(n) = 6*a(floor(n/4)) - a(floor(n/2)) for n=1 (mod 4),
%F A116640 a(n) = a(floor(n/2)) + 2*a(floor(n/4)) for n=2 (mod 4),
%F A116640 a(n) = 5*a(floor(n/2)) - 6*a(floor(n/4)) for n=3 (mod 4)
%F A116640 (End)
%F A116640 a(0) = 1, a(n) = 2*a(floor(n/2)) - A033999(n) * A048883(n) for n>0. -
%F A116640 _Joe Slater_, Jan 22 2016
%p A116640 a:= proc(n) option remember; piecewise(
%p A116640     n mod 4 = 0, 3*procname(n/2) - 2*procname(n/4),
%p A116640   n mod 4 = 1, 6*procname((n-1)/4) - procname((n-1)/2),
%p A116640   n mod 4 = 2, procname(n/2) + 2*procname((n-2)/4),
%p A116640   5*procname((n-1)/2) - 6*procname((n-3)/4))
%p A116640 end proc:
%p A116640 a(0):= 1:
%p A116640 map(a, [$0..100]); # _Robert Israel_, Jan 19 2016
%t A116640 a[n_] := a[n] = Switch[Mod[n, 4], 0, 3a[Floor[n/2]] - 2a[Floor[n/4]], 1, 6a[Floor[n/4]] - a[Floor[n/2]], 2, a[Floor[n/2]] + 2a[Floor[n/4]], 3, 5a[Floor[n/2]] - 6a[Floor[n/4]]]; a[0]=1; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Feb 28 2016 *)
%o A116640 (PARI) a(n) = if(n==0, return(1)); 2*a(n\2) - (-1)^n * 3^hammingweight(n) \\ _Charles R Greathouse IV_, Jan 21 2016
%o A116640 (PARI) a(n) = my(p=2*n+1,v=vecextract(vector(#binary(p),j,2^(j-1)),p));sum(i=0,#v-1,3^i*v[#v-i]) \\ _Joe Slater_, May 09 2017
%Y A116640 Cf. A000079, A000225, A001047, A062709.
%K A116640 nonn,base,tabf
%O A116640 0,2
%A A116640 _Antti Karttunen_, Feb 20 2006. Proposed by Pierre Lamothe (plamothe(AT)aei.ca), May 21 2004