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.
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
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000
- Kevin Ryde, Iterations of the Dragon Curve, see index TurnRight, with a(n) = TurnRight(n-2) + 1 for n>=2.
Programs
-
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: seq(a(n), n=1..100); # Alois P. Heinz, Feb 12 2013
-
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 *)
-
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
Formula
a(1) = 1; and for n > 1: a(n) = A091067(n-1)+1. - Antti Karttunen, Feb 20 2015, based on N. Sato's Feb 12 2013 comment above.
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), May 10 2001
Comments