login
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).
1
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,2
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.
LINKS
EXAMPLE
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.
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 *)
PROG
(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)
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph C. Y. Wong, Mar 24 2024
STATUS
approved