|
|
A060833
|
|
Separate the natural numbers into disjoint sets A, B with 1 in A, such that the sum of any 2 distinct elements of the same set never equals 2^k + 2. Sequence gives elements of set A.
|
|
5
|
|
|
1, 4, 7, 8, 12, 13, 15, 16, 20, 23, 24, 25, 28, 29, 31, 32, 36, 39, 40, 44, 45, 47, 48, 49, 52, 55, 56, 57, 60, 61, 63, 64, 68, 71, 72, 76, 77, 79, 80, 84, 87, 88, 89, 92, 93, 95, 96, 97, 100, 103, 104, 108, 109, 111, 112, 113, 116, 119, 120, 121, 124, 125, 127, 128
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Can be constructed as follows: place of terms of (2^k+1,2^k+2,...,2^k) are the reflection from (2,3,4,...,2^k,1). [Comment not clear to me - N. J. A. Sloane]
If n == 0 mod 4, then n is in the sequence. If n == 2 mod 4, then n is not in the sequence. The number 2n - 1 is in the sequence if and only if n is in the sequence. For n > 1, n is in the sequence if and only if A038189(n-1) = 1. - N. Sato, Feb 12 2013
The set B contains all numbers 2^(k-1)+1 = (2^k+2)/2 (half of the "forbidden sums"), (2, 3, 5, 9, 17, 33, 65,...) = 1/2 * (4, 6, 10, 18, 34, 66, 130, 258,...). - M. F. Hasler, Feb 12 2013
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
a:= proc(n) option remember; local k, t;
if n=1 then 1
else for k from 1+a(n-1) do t:= k-1;
while irem(t, 2, 'r')=0 do t:=r od;
if irem(t, 4)=3 then return k fi
od
fi
end:
|
|
MATHEMATICA
|
a[n_] := a[n] = Module[{k, t, q, r}, If[n == 1, 1, For[k = 1+a[n-1], True, k++, t = k-1; While[{q, r} = QuotientRemainder[t, 2]; r == 0, t = q]; If[Mod[t, 4] == 3, Return[k]]]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 30 2017, after Alois P. Heinz *)
|
|
PROG
|
(PARI) a(n) = if(n=2*n-2, my(t=1); forstep(i=logint(n, 2), 0, -1, if(bittest(n, i)==t, n++; t=!t))); n+1; \\ Kevin Ryde, Mar 21 2021
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
More terms from Larry Reeves (larryr(AT)acm.org), May 10 2001
|
|
STATUS
|
approved
|
|
|
|