login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A214410 Numbers that can't be expressed as the sum of a square and a Fibonacci number. 1
15, 20, 23, 31, 32, 40, 42, 45, 47, 48, 53, 58, 60, 61, 63, 68, 73, 74, 75, 76, 78, 79, 87, 88, 92, 95, 96, 97, 99, 106, 107, 109, 110, 111, 112, 116, 117, 118, 120, 127, 128, 130, 131, 132, 133, 135, 137, 139, 140, 141, 143, 150, 151, 154, 156, 158, 159, 161 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
0 is considered to be a Fibonacci number.
LINKS
EXAMPLE
17 = 16+1, 16 is a square and 1 is a Fibonacci number, so 17 is not in the sequence.
MAPLE
q:= proc(n) local f, g; f, g:= 0, 1;
do if f>n then return true
elif issqr(n-f) then return false
else f, g:= g, f+g
fi od
end:
select(q, [$0..200])[]; # Alois P. Heinz, May 22 2021
MATHEMATICA
nn = 161; sq = Range[0, 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 *)
PROG
(Python)
prpr = 0
prev = 1
fib = [0]*100
for n in range(100):
fib[n] = prpr
curr = prpr+prev
prpr = prev
prev = curr
for n in range(1234):
i = yes = 0
while i*i<=n:
r = n - i*i
if r in fib:
yes = 1
break
i += 1
if yes==0:
print(n, end=', ')
(Python)
from sympy import fibonacci
from itertools import count, takewhile
def aupto(lim):
fbs = list(takewhile(lambda x: x<=lim, (fibonacci(i) for i in count(0))))
sqs = list(takewhile(lambda x: x<=lim, (i*i for i in count(0))))
return sorted(set(range(1, lim+1)) - set(f+s for f in fbs for s in sqs))
print(aupto(161)) # Michael S. Branicky, May 22 2021
CROSSREFS
Sequence in context: A171808 A134617 A113529 * A102495 A133288 A322710
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Jul 16 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 17 23:23 EDT 2024. Contains 371767 sequences. (Running on oeis4.)