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.

A360995 a(1)=0, a(2)=4, and thereafter a(n) is the smallest unused difference between two numbers whose product is equal to a(n-1)*a(n-2).

This page as a plain text file.
%I A360995 #31 Mar 11 2023 19:48:19
%S A360995 0,4,1,3,2,5,9,12,23,11,252,19,13,6,7,41,34,65,31,142,111,139,28,264,
%T A360995 46,40,57,17,32,15,14,29,51,22,49,27,42,33,45,84,16,10,36,18,63,67,
%U A360995 180,44,38,54,21,117,24,77,53,360,39,66,73,113,8248,127,1554,137
%N A360995 a(1)=0, a(2)=4, and thereafter a(n) is the smallest unused difference between two numbers whose product is equal to a(n-1)*a(n-2).
%H A360995 Samuel Harkness, <a href="/A360995/b360995.txt">Table of n, a(n) for n = 1..10000</a>
%e A360995 To find a(8), we look at the last two terms of the sequence so far (0,4,1,3,2,5,9). Their product 5*9=45 can be expressed as factor pairs (1,45), (3,15), (5,9) of which 3 and 15 have the smallest unused difference (12). We cannot use 9-5=4 because 4 is already in the sequence, so a(8)=12.
%p A360995 S:= {0,4,1}:
%p A360995 R:= 0,4,1:
%p A360995 for n from 4 to 100 do
%p A360995   s:= R[-1]*R[-2];
%p A360995   cands:= select(type,map(t -> s/t - t, numtheory:-divisors(s)),posint) minus S;
%p A360995   if cands = {} then printf("Sequence stops at n = %d\n",n); break fi;
%p A360995   x:= min(cands);
%p A360995   R:= R,x;
%p A360995   S:= S union {x};
%p A360995 od:
%p A360995 R; # _Robert Israel_, Mar 01 2023
%t A360995 K = {0, 4, 1}; For[a = 4, a < 65, a++, If[q == 0, Print["Finite List, length ", Length[K]]; Break[]]; d = Divisors[K[[a - 1]]*K[[a - 2]]]; If[OddQ[Length[d]], d = Delete[d, (Length[d] + 1)/2]]; For[q = Length[d]/2, q > 0, q--, If[!MemberQ[K, d[[Length[d] - q + 1]] - d[[q]]], AppendTo[K, d[[Length[d] - q + 1]] - d[[q]]]; Break[]]]]; Print[K] (* _Samuel Harkness_, Feb 28 2023 *)
%Y A360995 Cf. A359035.
%K A360995 nonn
%O A360995 1,2
%A A360995 _Neal Gersh Tolunsky_, Feb 27 2023