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.

A336164 a(1) = 1; if n>1, and gcd(a(n-1), n) > 1 then a(n) = a(n-1)/gcd(a(n-1), n), otherwise a(n) = a(n-1) + n - 1.

Original entry on oeis.org

1, 2, 4, 1, 5, 10, 16, 2, 10, 1, 11, 22, 34, 17, 31, 46, 62, 31, 49, 68, 88, 4, 26, 13, 37, 62, 88, 22, 50, 5, 35, 66, 2, 1, 35, 70, 106, 53, 91, 130, 170, 85, 127, 170, 34, 17, 63, 21, 3, 52, 102, 51, 103, 156, 210, 15, 5, 62, 120, 2, 62, 1, 63, 126, 190, 95, 161, 228, 76
Offset: 1

Views

Author

Todor Szimeonov, Jul 10 2020

Keywords

Crossrefs

Cf. A133058.

Programs

  • PARI
    a(n) = if (n==1, 1, my(prec=a(n-1)); if (gcd(prec, n) > 1, prec/gcd(prec,n), n-1+prec)); \\ Michel Marcus, Jul 13 2020
    
  • Python
    from itertools import count, islice
    from math import gcd
    def A336164_gen(): # generator of terms
        yield (a:=1)
        for n in count(2):
            yield (a:=a+n-1 if (b:=gcd(a,n)) == 1 else a//b)
    A336164_list = list(islice(A336164_gen(),30)) # Chai Wah Wu, Mar 18 2023