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.

User: Thomas W. Young

Thomas W. Young's wiki page.

Thomas W. Young has authored 1 sequences.

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.

Original entry on oeis.org

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
Offset: 1

Author

Thomas W. Young, Mar 09 2024

Keywords

Examples

			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.
		

Crossrefs

Cf. A117818.

Programs

  • Maple
    A371061 := proc(n)
        option remember ;
        if n <= 2 then
            n;
        else
            A117818(procname(n-1))+A117818(procname(n-2)) ;
        end if;
    end proc:
    seq(A371061(n),n=1..100) ; # R. J. Mathar, Apr 30 2024
  • Mathematica
    A117818[n_] := If[n == 1 || PrimeQ[n], n, Divisors[n][[-2]]];
    A371061[n_] := A371061[n] = If[n < 3, n, A117818[A371061[n-1]] + A117818[A371061[n-2]]];
    Array[A371061, 100] (* Paolo Xausa, May 24 2024 *)
  • 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
  • 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)
    

Formula

a(n) = A117818(a(n-1)) + A117818(a(n-2)) for n > 2.
a(n+18) = a(n) for n >= 39. - R. J. Mathar, May 24 2024