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).
0, 4, 1, 3, 2, 5, 9, 12, 23, 11, 252, 19, 13, 6, 7, 41, 34, 65, 31, 142, 111, 139, 28, 264, 46, 40, 57, 17, 32, 15, 14, 29, 51, 22, 49, 27, 42, 33, 45, 84, 16, 10, 36, 18, 63, 67, 180, 44, 38, 54, 21, 117, 24, 77, 53, 360, 39, 66, 73, 113, 8248, 127, 1554, 137
Offset: 1
Keywords
Examples
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.
Links
- Samuel Harkness, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A359035.
Programs
-
Maple
S:= {0,4,1}: R:= 0,4,1: for n from 4 to 100 do s:= R[-1]*R[-2]; cands:= select(type,map(t -> s/t - t, numtheory:-divisors(s)),posint) minus S; if cands = {} then printf("Sequence stops at n = %d\n",n); break fi; x:= min(cands); R:= R,x; S:= S union {x}; od: R; # Robert Israel, Mar 01 2023
-
Mathematica
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 *)