A067182 Smallest Fibonacci number with digit sum n, or -1 if no such number exists.
0, 1, 2, 3, 13, 5, -1, 34, 8, 144, 55
Offset: 0
Examples
a(14) = 4181, as it is the smallest Fibonacci number with a digit sum of 14.
Links
- Hans Havermann, Table of n, a(n) for n = 1..10000 (Note that this is not what would be called a b-file in the OEIS, since the -1 entries except for the first are conjectural, and a b-file may not contain conjectured values. - _N. J. A. Sloane_, Feb 05 2017)
- Hans Havermann, Table of n, a(n) for n = 1..10000 (the -1's, except for the first, are only conjectural). [Cached copy, with permission]
- Joseph Myers and Don Reble, Re: What are the possible digit-sums for Fibonacci numbers? (click "next" to see the second post), SeqFan list, Dec 27 2016
Programs
-
Mathematica
Take[#, 48] &@ Function[w, Function[t, {0}~Join~ReplacePart[t, Flatten@ Map[{#2 -> #1} & @@ # &, w]]]@ ConstantArray[0, w[[-1, -1]]]]@ Map[First, SplitBy[#, Last]] &@ SortBy[#, Last] &@ Table[{#, Total@ IntegerDigits@ #} &@ Fibonacci@ n, {n, 10^4}] (* Michael De Vlieger, Dec 28 2016 *) a = 0; b = c = 1; t[] = -1; While[a < 10^1000, s = Plus @@ IntegerDigits[a]; If[s < 101 && t[s] == -1, t[s] = a]; a = b; b = c; c = a + b]; Array[t, 48, 0] (* _Robert G. Wilson v, Jan 25 2017 *)
-
PARI
A067182(n,a=1,b=-1)=-!for(k=0,n+99,sumdigits(a=b+b=a)==n&&return(a)) \\ M. F. Hasler, Dec 28 2016
Formula
Extensions
More terms from Frank Ellermann, Jan 18 2002
More terms from Jason Earls, May 27 2002
Edited by M. F. Hasler, Dec 26 2016 and Dec 28 2016
Edited (including changing the value of a(n) for when no k exists from 0 to -1) by N. J. A. Sloane, Dec 29 2016 and Feb 05 2017
Comments