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.

A181717 Fibonacci-Collatz sequence: a(1)=0, a(2)=1; for n>2, let fib=a(n-1)+a(n-2); if fib is odd then a(n)=3*fib+1 else a(n)=fib/2.

This page as a plain text file.
%I A181717 #28 Mar 25 2024 06:48:24
%S A181717 0,1,4,16,10,13,70,250,160,205,1096,3904,2500,3202,2851,18160,63034,
%T A181717 40597,310894,1054474,682684,868579,4653790,16567108,10610449,
%U A181717 81532672,276429364,178981018,227705191,1220058628,4343291458,2781675043,21374899504,72469723642
%N A181717 Fibonacci-Collatz sequence: a(1)=0, a(2)=1; for n>2, let fib=a(n-1)+a(n-2); if fib is odd then a(n)=3*fib+1 else a(n)=fib/2.
%C A181717 It is easy to prove that all the terms a(n) with n>=7 are congruent to 7 mod 9. Conjecture: for every k>0 there is an index m such that all the a(n) with n>m have the same residue mod 3^k. - _Giovanni Resta_, Nov 17 2010
%H A181717 Reinhard Zumkeller, <a href="/A181717/b181717.txt">Table of n, a(n) for n = 1..1000</a>
%p A181717 a:= proc(n) option remember; local f;
%p A181717       if n<3 then return n-1 fi;
%p A181717       f:= a(n-1) +a(n-2);
%p A181717       `if`(irem(f, 2)=0, f/2, 3*f+1)
%p A181717     end:
%p A181717 seq(a(n), n=1..50); # _Alois P. Heinz_, Oct 09 2011
%t A181717 nxt[{a_,b_}]:=Module[{fib=a+b},If[OddQ[fib],{b,3fib+1},{b,fib/2}]]; Transpose[NestList[nxt,{0,1},40]][[1]] (* _Harvey P. Dale_, Mar 21 2012 *)
%o A181717 (PARI) v=vector(60,n,0); v[2]=1; for(n=3,60,f=v[n-1]+v[n-2]; v[n]=if(f%2,3*f+1,f/2))
%o A181717 (Haskell)
%o A181717 a181717 n = a181717_list !! (n-1)
%o A181717 a181717_list = 0 : 1 : fc 1 0 where
%o A181717    fc x x' = y : fc y x where y = a006370 (x + x')
%o A181717 -- _Reinhard Zumkeller_, Oct 09 2011
%o A181717 (SageMath)
%o A181717 @CachedFunction
%o A181717 def a(n):
%o A181717     if n<3: return n-1
%o A181717     elif (a(n-1)+a(n-2))%2==1: return 3*(a(n-1)+a(n-2))+1
%o A181717     else: return (a(n-1)+a(n-2))/2
%o A181717 [a(n) for n in range(1,51)] # _G. C. Greubel_, Mar 25 2024
%Y A181717 Cf. A000045, A006370, A105801.
%K A181717 nonn
%O A181717 1,3
%A A181717 _Ralf Stephan_, Nov 17 2010