The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A306835 a(0) = 0, a(1) = 1. For k > 1, k is inserted in the sequence between the last pair of consecutive terms already in the sequence which sum to k; if no such pair exists, k is added at the end of the sequence. 2
0, 1, 4, 3, 5, 7, 16, 9, 11, 24, 13, 15, 17, 19, 40, 21, 23, 25, 27, 29, 31, 64, 33, 35, 37, 76, 39, 41, 43, 88, 45, 47, 96, 49, 100, 51, 53, 55, 112, 57, 59, 61, 124, 63, 65, 67, 136, 69, 71, 73, 148, 75, 77, 79, 160, 81, 83, 85, 172, 87, 89 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
David A. Corneth, PARI program
EXAMPLE
The first iterations of the sequence are as follows:
[0, 1];
[0, 1, 2];
[0, 1, 3, 2], since 1 + 2 = 3;
[0, 1, 4, 3, 2], since 1 + 3 = 4;
[0, 1, 4, 3, 5, 2], since 3 + 2 = 5 (and appears later in the sequence than 1 + 4);
[0, 1, 4, 3, 5, 2, 6].
MATHEMATICA
With[{nn = 270}, TakeWhile[Partition[Nest[Function[{a, n}, If[Length@ # == 0, Append[a, n], Insert[a, n, 1 + #[[-1, 1]] ]] &@ Position[Total /@ Partition[a, 2, 1], n] ] @@ {#, Length@ #} &, {0}, nn], 2, 1], Total@ # < nn &]][[All, 1]] (* Michael De Vlieger, Mar 24 2019 *)
PROG
(Python3)
seq = [0, 1]
for n in range(2, 281):
for k in range(len(seq) - 1, 0, -1):
if seq[k] + seq[k - 1] == n:
seq.insert(k, n)
break
else: seq += [n]
print(seq[:100])
(PARI) See Corneth link \\ David A. Corneth, Mar 24 2019
CROSSREFS
Sequence in context: A171021 A035427 A257120 * A033546 A236360 A299323
KEYWORD
nonn,easy
AUTHOR
Jan Koornstra, Mar 12 2019
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 May 21 08:56 EDT 2024. Contains 372733 sequences. (Running on oeis4.)