%I #22 Feb 13 2021 01:14:27
%S 2,3,5,7,8,10,13,15,16,18,20,21,23,89,91,92,94,96,97,99,102,104,105,
%T 107,109,110,112,233,235,236,238,240,241,243,246,248,249,251,253,254,
%U 256,322,324,325,327,329,330,332,335,337,338,340,342,343,345,1597,1599,1600
%N Numbers that are the sum of distinct Fibonacci primes.
%H Robert Israel, <a href="/A159556/b159556.txt">Table of n, a(n) for n = 1..10000</a>
%e For example: 7 = 5 + 2; 2 and 5 are Fibonacci numbers which are prime.
%p fibprimes:= select(isprime,[2,3,seq(combinat:-fibonacci(ithprime(i)),i=3..100)]):
%p S:= expand(mul(1+x^p, p = fibprimes[1..11])):
%p sort(convert(map2(op,2,indets(S,`^`)),list)): # _Robert Israel_, Jul 16 2015
%t Union[Plus@@@Subsets[{2,3,5,13,89,233,1597}]] (* _T. D. Noe_, Apr 16 2009 *)
%t fibPrime={2,3,5,13,89,233,1597}; t=Rest[CoefficientList[Series[Product[1+x^fibPrime[[k]], {k,Length[fibPrime]}], {x,0,fibPrime[[ -1]]}],x]]; Flatten[Position[t,_?(#>0&)]] (* _T. D. Noe_, Apr 15 2009 *)
%o (C) #include <stdio.h>
%o #define MAX_FIB 6
%o #define MAX_CALC 2580
%o int main() {
%o int fibs[] = {2, 3, 5, 13, 89, 233, 1597};
%o int num = 0;
%o int x = 0;
%o int index = 0;
%o for(x=1; x<MAX_CALC; x++) {
%o num = x;
%o for(index=MAX_FIB; index>-1; index--)
%o if(fibs[index]<=num) num-=fibs[index];
%o if(num==0) printf("%d, ", x);
%o }
%o printf("\n");
%o return 0;
%o }
%Y Cf. A005478 (Fibonacci primes).
%K nonn
%O 1,1
%A Jose Manuel Hernandez Jr. (j.hernandez38(AT)umiami.edu), Apr 14 2009
%E Name corrected by _T. D. Noe_, Apr 15 2009
|