login
a(1) = 1; for n>1, a(n) = number of values k in range 1 .. n-1 such that {sum of prime indices in the prime factorization of a(k)} = {sum of prime indices in the prime factorization of a(n-1)}, both counted with multiplicity.
6

%I #21 Oct 26 2014 20:49:17

%S 1,1,2,1,3,1,4,2,2,3,3,4,5,1,5,2,4,6,3,7,1,6,4,8,5,6,7,2,5,8,9,3,9,4,

%T 10,5,10,6,11,1,7,7,8,12,9,10,11,2,6,13,1,8,14,3,11,4,12,12,13,2,7,14,

%U 5,15,6,16,15,7,16,17,1,9,18,8,17,2,8,18,9,19,1,10,20,10,21,3,13,4,14,11,12,22,5,19,2,9,23,1

%N a(1) = 1; for n>1, a(n) = number of values k in range 1 .. n-1 such that {sum of prime indices in the prime factorization of a(k)} = {sum of prime indices in the prime factorization of a(n-1)}, both counted with multiplicity.

%C The initial occurrences of primes appear in ascending order. After a(1) and a(2), 1's occur only after each such initial occurrence of a prime, followed by that prime's index (in A000040) + 2.

%H Antti Karttunen, <a href="/A249336/b249336.txt">Table of n, a(n) for n = 1..12580</a>

%F a(1) = 1; for n>1, a(n) = number of values k in range 1 .. n-1 such that A056239(a(k)) = A056239(a(n-1)).

%e a(1) = 1 by definition.

%e For n = 2, we see that a(n-1) = a(1) = 1, the sum of whose prime indices is 0, and the only integer k for which A056239(k) = 0 is 1, and 1 occurs once among the terms a(1) .. a(1), thus a(2) = 1 also.

%e For n = 3, we see that a(n-1) = a(2) = 1 occurs two times among the terms a(1) .. a(2), thus a(3) = 2.

%e For n = 4, we see that a(n-1) = a(3) = 2, and A056239(2) = 1, and so far there are no other terms than a(3) in a(1) .. a(3) which would result the same sum, thus a(4) = 1.

%e For n = 5, we see that a(n-1) = a(4) = 1 occurs three times in a(1) .. a(4), thus a(5) = 3.

%e For n = 6, we see that a(n-1) = a(5) = 3, and A056239(3) = 2 (as 3 = p_2), and so far there are no other terms than a(5) in a(1) .. a(5) which would result the same sum, thus a(6) = 1.

%e For n = 7, we see that a(n-1) = a(6) = 1 occurs four times in a(1) .. a(6), thus a(7) = 4.

%e For n = 8, we see that a(n-1) = a(7) = 4, and A056239(4) = 2 (as 4 = p_1 * p_1), and so far among the terms a(1) .. a(7) only a(5) results in the same sum, thus a(8) = 2.

%o (PARI)

%o A049084(n) = if(isprime(n), primepi(n), 0); \\ This function from _Charles R Greathouse IV_

%o A056239(n) = { my(f); if(1==n, 0, f=factor(n); sum(i=1, #f~, f[i,2] * A049084(f[i,1]))); }

%o A249336_write_bfile(up_to_n) = { my(counts, n, a_n); counts = vector(up_to_n); a_n = 1; for(n = 1, up_to_n, write("b249336.txt", n, " ", a_n); counts[1+A056239(a_n)]++; a_n = counts[1+A056239(a_n)]); };

%o A249336_write_bfile(12580);

%o (Scheme, with memoization-macro definec from _Antti Karttunen_'s IntSeq-library)

%o (definec (A249336 n) (if (<= n 1) n (let ((s (A056239 (A249336 (- n 1))))) (let loop ((i (- n 1)) (k 0)) (cond ((zero? i) k) ((= (A056239 (A249336 i)) s) (loop (- i 1) (+ k 1))) (else (loop (- i 1) k))))))) ;; Slow, quadratic time implementation.

%Y Cf. A056239, A249338 (sum of prime indices of n-th term), A249339 (positions of ones), A249340 (positions of first occurrences of each noncomposite).

%Y Cf. also A249337 (a similar sequence with a slightly different starting condition), A249148.

%K nonn

%O 1,3

%A _Antti Karttunen_, Oct 25 2014