

A249148


a(1) = 1, after which, if a(n1) = 1, a(n) = 1 + the total number of 1's that have occurred in the sequence so far, otherwise a(n) = the total number of times the least prime dividing a(n1) [i.e., A020639(a(n1))] occurs as a divisor (counted with multiplicity for each term) in the previous terms from a(1) up to and including a(n1).


6



1, 2, 1, 3, 1, 4, 3, 2, 4, 6, 7, 1, 5, 1, 6, 8, 11, 1, 7, 2, 12, 14, 15, 6, 16, 20, 22, 23, 1, 8, 26, 27, 10, 28, 30, 31, 1, 9, 13, 2, 32, 37, 1, 10, 38, 39, 14, 40, 43, 1, 11, 3, 15, 16, 47, 1, 12, 49, 7, 8, 52, 54, 55, 9, 22, 56, 59, 1, 13, 5, 10, 60, 62, 63, 25, 14, 64, 70, 71, 1, 14, 72, 75, 28, 77, 15, 29, 1, 15, 30, 78, 79, 1, 16, 83
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

After a(1), it is very likely that 1's occur only just after primes, although they do not necessarily occur after every prime. For example, 13 is the first prime whose initial occurrence is not followed by 1.


LINKS



EXAMPLE

a(1) = 1 by definition.
For n = 2, we see that a(1) = 1, which is the only 1 that has occurred in the sequence so far, and thus a(2) = 1+1 = 2.
For n = 3, we see that a(2) = 2, with the least prime dividing it being 2, which has occurred so far only once (namely in a(2)), thus a(3) = 1.
For n = 4, we see that a(3) = 1, and there has occurred two 1's so far (as a(1) and a(3)), thus a(4) = 2+1 = 3.
For n = 5, we see that a(4) = 3, with the least prime dividing it being 3, which has occurred now just once, thus a(5) = 1.
For n = 6, we see that a(5) = 1, and there has occurred three 1's so far (as a(1), a(3) and a(5)), thus a(6) = 3+1 = 4.
For n = 7, we see that a(6) = 4 = 2*2, with its least prime 2 dividing it two times, and also occurring once at a(2), thus a(7) = 3.


PROG

(PARI)
A249148_write_bfile(up_to_n) = { my(pfcounts, n, a_n, f, k); pfcounts = vector(up_to_n); a_n = 1; for(n = 1, up_to_n, if((1 == a_n), pfcounts[1]++; a_n = pfcounts[1], f=factor(a_n); for(i=1, #f~, k = A049084(f[i, 1])+1; pfcounts[k] += f[i, 2]); a_n = pfcounts[A049084(f[1, 1])+1]); write("b249148.txt", n, " ", a_n)); };
(MIT/GNU Scheme with memoizing definecmacro from Antti Karttunen's IntSeqlibrary and factor function from Aubrey Jaffer's SLIBlibrary)
(definec (A249148 n) (if (= 1 n) 1 (vectorref (A249148aux_primefactor_counts ( n 1)) (A055396 (A249148 ( n 1))))))
(definec (A249148aux_primefactor_counts n) (cond ((= 1 n) (vector 2)) (else (let* ((a_n (A249148 n)) (copyofprevec (vectorcopy (A249148aux_primefactor_counts ( n 1)))) (newsize (max (vectorlength copyofprevec) (+ 1 (A061395 a_n)))) (pf_counts_vec (vectorgrow copyofprevec newsize))) (let loop ((pf_indices (map A049084 (factor a_n)))) (cond ((null? pf_indices) pf_counts_vec) (else (vectorset! pf_counts_vec (car pf_indices) (+ 1 (or (vectorref pf_counts_vec (car pf_indices)) 0))) (loop (cdr pf_indices)))))))))


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



