cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Sen-Peng Eu, May 01 2001

Keywords

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

Crossrefs

Essentially one more than A091067.
First differences: A106836.
A082410(a(n)) = 0.

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