cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A254123 Least number of terms needed to build n from Fibonacci numbers using + and *.

This page as a plain text file.
%I A254123 #7 Jan 25 2015 21:19:21
%S A254123 1,1,1,2,1,2,2,1,2,2,2,3,1,2,2,2,3,2,3,3,1,2,2,2,2,2,3,3,2,3,3,3,3,1,
%T A254123 2,2,2,3,2,2,3,2,3,3,3,3,2,3,3,3,4,3,3,3,1,2,2,2,3,2,3,3,2,2,2,3,3,2,
%U A254123 3,3,3,3,3,3,3,2,3,3,3,3,3,4,4,3,3,3,3,3,1,2,2,2
%N A254123 Least number of terms needed to build n from Fibonacci numbers using + and *.
%C A254123 a(n) = 1 iff n is a Fibonacci number (A000045).
%C A254123 a(n) = 2 iff n is in A254122.
%C A254123 a(A025282(n)) = n.
%H A254123 Robert Israel, <a href="/A254123/b254123.txt">Table of n, a(n) for n = 1..10000</a>
%e A254123 a(40) = 2 because 40 = 5*8; 5 and 8 are Fibonacci numbers but 40 is not.
%p A254123 N:= 1000: # to get a(1) to a(N)
%p A254123 A:= Vector(N):
%p A254123 for i from 1 do
%p A254123   f:= combinat:-fibonacci(i);
%p A254123   if f > N then break fi;
%p A254123   A[f]:= 1
%p A254123 od:
%p A254123 for n from 1 to N do
%p A254123   if A[n] = 0 then
%p A254123      m:= floor(n/2);
%p A254123      r:= min(A[1..m] + A[[seq(n-i,i=1..m)]]);
%p A254123      for a in select(`<=`, numtheory:-divisors(n) minus {1}, floor(sqrt(n))) do
%p A254123         r:= min(r, A[a] + A[n/a])
%p A254123      od:
%p A254123      A[n]:= r;
%p A254123   fi
%p A254123 od:
%p A254123 seq(A[i],i=1..N);
%Y A254123 Cf. A000045, A025282, A254122.
%K A254123 nonn
%O A254123 1,4
%A A254123 _Robert Israel_, Jan 25 2015