%I #23 Mar 09 2016 08:09:52
%S 4,9,12,25,27,169,1102,7921,22287,54289,103823,777627,876897,2550409,
%T 20854593,34652571,144237401,144342653,167901581,267911895,792504416,
%U 821223649,1103528482,2040412557,2852002829,3493254541,6033671841,15658859018,116085000401
%N Primonacci numbers: composite numbers that appear in the Fibonacci-like sequence generated by their own prime factors.
%C Given n, form a sequence that starts with the k prime factors of n in ascending order. After that, each term is the sum of the preceding k terms. If n eventually appears in the sequence, it is a primonacci number. Primes possess this property trivially and are therefore excluded.
%C Similar to A007629 (repfigit or Keith numbers), but base-independent. If n is in A005478 (Fibonacci primes), then n^2 is a primonacci number.
%C The only entries that are semiprimes (A001358) are the squares of A005478. - _Robert Israel_, Mar 08 2016
%H Herman Beeksma, <a href="/A212875/b212875.txt">Table of n, a(n) for n = 1..42</a>
%e Fibonacci-like sequences for selected values of n:
%e n=12: 2, 2, 3, 7, 12, ...
%e n=25: 5, 5, 10, 15, 25, ...
%e n=1102: 2, 19, 29, 50, 98, 177, 325, 600, 1102, ...
%p with(numtheory): P:=proc(q,h) local a,b,j,k,n,t,v; v:=array(1..h);
%p for n from 2 to q do if not isprime(n) then b:=ifactors(n)[2]; a:=[];
%p for k from 1 to nops(b) do for j from 1 to b[k][2] do a:=[op(a),b[k][1]]; od; od; a:=sort([op(a)]);
%p b:=nops(a); for k from 1 to b do v[k]:=a[k]; od; t:=b+1; v[t]:=add(v[k], k=1..b);
%p while v[t]<n do t:=t+1; v[t]:=add(v[k], k=t-b..t-1); od;
%p if v[t]=n then print(n); fi; fi; od; end: P(10^12,1000); # _Paolo P. Lava_, Mar 08 2016
%t PrimonacciQ[n_]:=Module[{k,seq},
%t seq=FactorInteger[n];
%t seq=Map[Table[#[[1]],{#[[2]]}]&, seq];
%t seq=Flatten[seq];
%t k=Length[seq];
%t If[k==1,Return[False]];
%t seq=Append[seq,Apply[Plus,seq]];
%t While[seq[[-1]]<n,seq=Append[seq,2*seq[[-1]]-seq[[-k-1]]]];
%t Return[seq[[-1]]==n]]; Select[Range[10000], PrimonacciQ]
%t Select[Range[10^6], Function[n, And[MemberQ[Union@ Flatten@ NestWhileList[Take[Append[#, Total@ #], -Length@ #] &, #, Last@ # <= n &, 1, 60] &[Flatten[Table[#1, {#2}] & @@@ FactorInteger@ n]], n], CompositeQ@ n]]@ # &] (* _Michael De Vlieger_, Mar 08 2016 *)
%o (Python)
%o from sympy import isprime, factorint
%o from itertools import chain
%o A212875_list = []
%o for n in range(2,10**6):
%o ....if not isprime(n):
%o ........x = sorted(chain.from_iterable([p]*e for p,e in factorint(n).items()))
%o ........y = sum(x)
%o ........while y < n:
%o ............x, y = x[1:]+[y], 2*y-x[0]
%o ........if y == n:
%o ............A212875_list.append(n) # _Chai Wah Wu_, Sep 12 2014
%Y Cf. A000045, A001358, A005478, A007629.
%K nonn
%O 1,1
%A _Herman Beeksma_, May 29 2012