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.

A327562 a(0) = a(1) = 1; for n > 1, a(n) = (a(n-1) + a(n-2)) / gcd(a(n-1), a(n-2)) if a(n-1) and a(n-2) are not coprime, otherwise a(n) = a(n-1) + a(n-2) + 1.

This page as a plain text file.
%I A327562 #22 Feb 14 2024 18:12:28
%S A327562 1,1,3,5,9,15,8,24,4,7,12,20,8,7,16,24,5,30,7,38,46,42,44,43,88,132,5,
%T A327562 138,144,47,192,240,9,83,93,177,90,89,180,270,5,55,12,68,20,22,21,44,
%U A327562 66,5,72,78,25,104,130,9,140,150,29,180,210,13,224,238,33,272,306
%N A327562 a(0) = a(1) = 1; for n > 1, a(n) = (a(n-1) + a(n-2)) / gcd(a(n-1), a(n-2)) if a(n-1) and a(n-2) are not coprime, otherwise a(n) = a(n-1) + a(n-2) + 1.
%C A327562 The sequence increases rapidly after n = 92.
%C A327562 From roughly n = 480 to n = 600, the sequence increases relatively fast and is almost a perfect exponential function.
%C A327562 Redefining a(0) and a(1) can result in drastically different sequences.
%H A327562 Harvey P. Dale, <a href="/A327562/b327562.txt">Table of n, a(n) for n = 0..1000</a>
%F A327562 a(0) = a(1) = 1; for n > 1, a(n) = (a(n-1) + a(n-2)) / gcd(a(n-1), a(n-2)) if gcd(a(n-1), a(n-2)) > 1, otherwise a(n) = a(n-1) + a(n-2) + 1.
%t A327562 a[0]=a[1]=1; a[n_] := a[n] = Block[{g = GCD[a[n-1], a[n-2]]}, If[g==1,
%t A327562 a[n-1] + a[n-2] + 1, (a[n-1] + a[n-2])/g]]; Array[a, 67, 0] (* _Giovanni Resta_, Sep 19 2019 *)
%t A327562 nxt[{a_,b_}]:={b,If[!CoprimeQ[a,b],(a+b)/GCD[a,b],a+b+1]}; NestList[nxt,{1,1},70][[;;,1]] (* _Harvey P. Dale_, Feb 14 2024 *)
%o A327562 (Python)
%o A327562 import math
%o A327562 def a(n): # Iteratively generates an array containing the first n terms of a(n), n should be greater than 2
%o A327562     a1 = 1 # this will hold a(n-1), its initial value is a(1)
%o A327562     a2 = 1 # this will hold a(n-2), its initial value is a(0)
%o A327562     terms = [None] * n
%o A327562     terms[0] = a2
%o A327562     terms[1] = a1
%o A327562     for i in range(2, n):
%o A327562         gcdPrev2 = math.gcd(a1, a2)
%o A327562         if(gcdPrev2 > 1):
%o A327562             terms[i] = int((a1 + a2) / gcdPrev2)
%o A327562         else:
%o A327562             terms[i] = a1 + a2 + 1
%o A327562         a2 = a1
%o A327562         a1 = terms[i]
%o A327562     return terms
%o A327562 (Magma) a:=[1,1]; for n in [3..67] do  if Gcd(a[n-1],a[n-2]) ne 1 then Append(~a,(a[n-1]+a[n-2])/Gcd(a[n-1],a[n-2])); else Append(~a,a[n-1]+a[n-2]+1); end if; end for; a; // _Marius A. Burtea_, Sep 19 2019
%Y A327562 Cf. A133058.
%K A327562 nonn
%O A327562 0,3
%A A327562 _Ian Band_, Sep 16 2019