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.
%I A371061 #37 May 25 2024 15:31:52 %S A371061 1,2,3,5,8,9,7,10,12,11,17,28,31,45,46,38,42,40,41,61,102,112,107,163, %T A371061 270,298,284,291,239,336,407,205,78,80,79,119,96,65,61,74,98,86,92,89, %U A371061 135,134,112,123,97,138,166,152,159,129,96,91,61,74,98 %N A371061 a(1)=1, a(2)=2; for n > 2, a(n) is the sum of the largest proper divisor of each of the previous two terms, except that the term itself is used if it has no proper divisors > 1. %H A371061 Paolo Xausa, <a href="/A371061/b371061.txt">Table of n, a(n) for n = 1..10000</a> %H A371061 <a href="/index/Rec#order_17">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1). %F A371061 a(n) = A117818(a(n-1)) + A117818(a(n-2)) for n > 2. %F A371061 a(n+18) = a(n) for n >= 39. - _R. J. Mathar_, May 24 2024 %e A371061 Each term is the sum of the largest proper divisors of the previous two terms. If a term has no proper divisors > 1 then take the number itself, e.g.: %e A371061 a(2) = 2 is prime, a(3) = 3 is prime, so a(4) = 2+3 = 5; %e A371061 a(3) = 3 is prime, a(4) = 5 is prime, so a(5) = 3+5 = 8; %e A371061 a(4) = 5 is prime, a(5) = 8, whose largest proper divisor is 4, so a(6) = 5+4 = 9; %e A371061 the largest proper divisors of 8 and 9 are 4 and 3, respectively, so a(7) = 4+3 = 7; etc. %p A371061 A371061 := proc(n) %p A371061 option remember ; %p A371061 if n <= 2 then %p A371061 n; %p A371061 else %p A371061 A117818(procname(n-1))+A117818(procname(n-2)) ; %p A371061 end if; %p A371061 end proc: %p A371061 seq(A371061(n),n=1..100) ; # _R. J. Mathar_, Apr 30 2024 %t A371061 A117818[n_] := If[n == 1 || PrimeQ[n], n, Divisors[n][[-2]]]; %t A371061 A371061[n_] := A371061[n] = If[n < 3, n, A117818[A371061[n-1]] + A117818[A371061[n-2]]]; %t A371061 Array[A371061, 100] (* _Paolo Xausa_, May 24 2024 *) %o A371061 (Python) %o A371061 import math %o A371061 def primeTest(num): %o A371061 ans = 0 %o A371061 if num == 1 or num == 2: %o A371061 return num %o A371061 for i in range(0,int(num**0.5)): %o A371061 if (num/(i+2)).is_integer() == True: %o A371061 ans = num/(i+2) %o A371061 break %o A371061 if ans == 0: %o A371061 ans = num %o A371061 return ans %o A371061 def seqgen(start): %o A371061 seq = start %o A371061 x = [0,1] %o A371061 for i in range(0,1000): %o A371061 list = ''.join(str(x) for x in seq) %o A371061 a = primeTest(seq[i]) %o A371061 b = primeTest(seq[i+1]) %o A371061 seq.append(int(a+b)) %o A371061 x.append(i+2) %o A371061 sublist = ''.join(str(x) for x in [seq[i],seq[i+1],seq[i+2]]) %o A371061 if sublist in list: %o A371061 break %o A371061 return i,x,seq %o A371061 start = [1,2] %o A371061 i,x,seq = seqgen(start) %o A371061 print(seq) %o A371061 (PARI) \\ b(n) is A117818(n). %o A371061 b(n)=if(n==1 || isprime(n), n, n/factor(n)[1,1]) %o A371061 seq(n) = {my(a=vector(n)); a[1]=1; a[2]=2; for(n=3, n, a[n] = b(a[n-1]) + b(a[n-2])); a} \\ _Andrew Howroyd_, Mar 09 2024 %Y A371061 Cf. A117818. %K A371061 nonn,easy %O A371061 1,2 %A A371061 _Thomas W. Young_, Mar 09 2024