OFFSET
1,2
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1).
FORMULA
a(n+18) = a(n) for n >= 39. - R. J. Mathar, May 24 2024
EXAMPLE
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.:
a(2) = 2 is prime, a(3) = 3 is prime, so a(4) = 2+3 = 5;
a(3) = 3 is prime, a(4) = 5 is prime, so a(5) = 3+5 = 8;
a(4) = 5 is prime, a(5) = 8, whose largest proper divisor is 4, so a(6) = 5+4 = 9;
the largest proper divisors of 8 and 9 are 4 and 3, respectively, so a(7) = 4+3 = 7; etc.
MAPLE
A371061 := proc(n)
option remember ;
if n <= 2 then
n;
else
end if;
end proc:
seq(A371061(n), n=1..100) ; # R. J. Mathar, Apr 30 2024
MATHEMATICA
PROG
(Python)
import math
def primeTest(num):
ans = 0
if num == 1 or num == 2:
return num
for i in range(0, int(num**0.5)):
if (num/(i+2)).is_integer() == True:
ans = num/(i+2)
break
if ans == 0:
ans = num
return ans
def seqgen(start):
seq = start
x = [0, 1]
for i in range(0, 1000):
list = ''.join(str(x) for x in seq)
a = primeTest(seq[i])
b = primeTest(seq[i+1])
seq.append(int(a+b))
x.append(i+2)
sublist = ''.join(str(x) for x in [seq[i], seq[i+1], seq[i+2]])
if sublist in list:
break
return i, x, seq
start = [1, 2]
i, x, seq = seqgen(start)
print(seq)
(PARI) \\ b(n) is A117818(n).
b(n)=if(n==1 || isprime(n), n, n/factor(n)[1, 1])
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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas W. Young, Mar 09 2024
STATUS
approved