Search: id:a371061
|
|
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.
|
|
+0
1
|
|
|
1, 2, 3, 5, 8, 9, 7, 10, 12, 11, 17, 28, 31, 45, 46, 38, 42, 40, 41, 61, 102, 112, 107, 163, 270, 298, 284, 291, 239, 336, 407, 205, 78, 80, 79, 119, 96, 65, 61, 74, 98, 86, 92, 89, 135, 134, 112, 123, 97, 138, 166, 152, 159, 129, 96, 91, 61, 74, 98
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
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
|
|
|
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
|
option remember ;
if n <= 2 then
n;
else
end if;
end proc:
|
|
MATHEMATICA
|
A117818[n_] := If[n == 1 || PrimeQ[n], n, Divisors[n][[-2]]];
|
|
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)
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
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.005 seconds
|