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.

A118362 a(1)=1; for n>1, a(n) = "n AND a(n-1)" if that number is positive and not already in the sequence, otherwise a(n) = "n OR a(n-1)".

This page as a plain text file.
%I A118362 #10 Dec 30 2012 06:12:25
%S A118362 1,3,3,7,5,4,7,15,9,8,11,15,13,12,15,31,17,16,19,23,21,20,23,31,25,24,
%T A118362 27,31,29,28,31,63,33,32,35,39,37,36,39,47,41,40,43,47,45,44,47,63,49,
%U A118362 48,51,55,53,52,55,63,57,56,59,63,61,60,63,127,65,64,67,71,69,68,71,79
%N A118362 a(1)=1; for n>1, a(n) = "n AND a(n-1)" if that number is positive and not already in the sequence, otherwise a(n) = "n OR a(n-1)".
%C A118362 Here "AND" and "OR" refer to operations on the binary expansions of the argument.
%o A118362 (PARI) A118362(maxn)= { local(a,aSet,aand,newa) ; a=[1] ; for(n=2,maxn, aSet=Set(a) ; aand=bitand(a[n-1],n) ; if( aand >0 && setsearch(aSet,aand) == 0, newa=aand, newa=bitor(a[n-1],n) ; ) ; a=concat(a,newa) ; print(newa) ; ) ; return(a) ; } print(A118362(80)) ; (Mathar)
%Y A118362 Cf. A005132.
%K A118362 nonn,easy
%O A118362 1,2
%A A118362 _N. J. A. Sloane_, May 17 2006
%E A118362 More terms from _R. J. Mathar_ and _Joshua Zucker_, May 18 2006