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.

A371473 a(1) = 1; for n>1, if a(n-1) is squarefree, a(n) = a(n-1) + n, otherwise a(n) = squarefree kernel of a(n-1).

Original entry on oeis.org

1, 3, 6, 10, 15, 21, 28, 14, 23, 33, 44, 22, 35, 49, 7, 23, 40, 10, 29, 49, 7, 29, 52, 26, 51, 77, 104, 26, 55, 85, 116, 58, 91, 125, 5, 41, 78, 116, 58, 98, 14, 56, 14, 58, 103, 149, 196, 14, 63, 21, 72, 6, 59, 113, 168, 42, 99, 33, 92, 46
Offset: 1

Views

Author

Joseph C. Y. Wong, Mar 24 2024

Keywords

Comments

Inspired by Recaman's sequence A005132.
Some nonsquarefree numbers will not appear in this sequence. However, I conjecture that all squarefree numbers will appear. First occurrence of 2 is at a(766) = 2.

Examples

			a(1) = 1 is squarefree, so a(2) = a(1) + 2 = 3.
a(7) = 28 = 2*2*7 is not squarefree, so a(8) = 2*7 = 14.
		

Crossrefs

Programs

  • Mathematica
    rad[n_]:=Product[Part[First/@FactorInteger[n],i],{i,Length[FactorInteger[n]]}]; a[1]=1; a[n_]:=If[SquareFreeQ[a[n-1]],a[n-1]+n,rad[a[n-1]]]; Array[a,60] (* Stefano Spezia, Mar 26 2024 *)
  • PARI
    lista(nn) = my(v = vector(nn)); v[1] = 1; for (n=2, nn, if (issquarefree(v[n-1]), v[n] = v[n-1]+n, v[n] = factorback(factor(v[n-1])[,1]));); v; \\ Michel Marcus, Mar 26 2024
  • Python
    from numpy import prod
    def primefact(a):
      factors = []
      d = 2
      while a > 1:
        while a % d == 0:
          factors.append(d)
          a /= d
        d = d + 1
      return factors
    def squarefree(a):
      return sorted(list(set(primefact(a)))) == sorted(primefact(a))
    sequence = [1]
    a = 1
    for n in range(1, 1001):
      if not squarefree(a):
        a = prod(list(set(primefact(a))))
      else:
        a += n+1
      sequence.append(a)
    print(sequence)