%I #10 May 22 2021 14:20:09
%S 0,8,13,15,20,23,31,32,34,40,42,45,47,48,53,55,58,60,61,63,68,73,74,
%T 75,76,78,79,87,88,92,95,96,97,99,106,107,109,110,111,112,116,117,118,
%U 120,127,128,130,131,132,133,135,137,139,140,141,143,150,151,154,156
%N Numbers that can't be expressed as the sum of a Fibonacci number and a square of a positive integer.
%C 0 is considered to be a Fibonacci number.
%p q:= proc(n) local f,g; f,g:= 0,1;
%p do if f>=n then return true
%p elif issqr(n-f) then return false
%p else f,g:= g,f+g
%p fi od
%p end:
%p select(q, [$0..200])[]; # _Alois P. Heinz_, May 22 2021
%t nn = 156; sq = Range[Sqrt[nn]]^2; fb = {}; i = 0; While[f = Fibonacci[i]; f < nn, i++; AppendTo[fb, f]]; fb = Union[fb]; Complement[Range[0, nn], Union[Flatten[Outer[Plus, sq, fb]]]] (* _T. D. Noe_, Jul 31 2012 *)
%o (Python)
%o prpr = 0
%o prev = 1
%o fib = [0]*100
%o for n in range(100):
%o fib[n] = prpr
%o curr = prpr+prev
%o prpr = prev
%o prev = curr
%o #print fib[n]
%o for n in range(777):
%o i = 1
%o yes = 0
%o while i*i<=n:
%o r = n - i*i
%o if r in fib:
%o yes = 1
%o break
%o i += 1
%o if yes==0:
%o print n,
%Y Cf. A000045, A132144, A214410.
%K nonn,easy
%O 1,2
%A _Alex Ratushnyak_, Jul 16 2012
|