

A365521


a(1) = 1; for n > 1, a(n) is the prime factor of n that has not appeared for the longest time in {a(1),...,a(n2),a(n1)}.


1



1, 2, 3, 2, 5, 3, 7, 2, 3, 5, 11, 2, 13, 7, 3, 2, 17, 3, 19, 5, 7, 11, 23, 2, 5, 13, 3, 7, 29, 2, 31, 2, 11, 17, 5, 3, 37, 19, 13, 2, 41, 7, 43, 11, 5, 23, 47, 3, 7, 2, 17, 13, 53, 3, 11, 7, 19, 29, 59, 5, 61, 31, 3, 2, 13, 11, 67, 17, 23, 7, 71, 3, 73, 37, 5, 19
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS



EXAMPLE

a(6)=3 because 6 = 2*3 and 2=a(4) has appeared more recently than 3=a(3).
a(12)=2 because 12 = 2^2*3 and 3=a(9) has appeared more recently than 2=a(8).
a(30)=2 because 30 = 2*3*5 and 3=a(27) and 5=a(25) have appeared more recently than 2=a(24).


PROG

(SageMath)
def hpf_seq(top):
H=[0, 1, 2, 3]
for n in range(4, top):
prime_factors=[part[0] for part in list(factor(n))]
cursor=1
while len(prime_factors)>1:
if H[cursor] in prime_factors:
prime_factors.remove(H[cursor])
cursor=1
hpf=prime_factors[0]
H.append(hpf)
return H


CROSSREFS



KEYWORD

nonn,easy


AUTHOR



STATUS

approved



