
#include "bits/bit-paper-fold.h"

#include "demo/nextarg.h"
#include "fxttypes.h"  // ulong


//% Generate the paper-folding sequence.


int
main(int argc, char **argv)
{
    ulong n = 65;
    NXARG(n, "Number of bits generated");

    for (ulong k=1; k<=n; ++k)  // note start with k==1
    {
        bool p = bit_paper_fold(k);

        cout << (p==0 ? '.' : '1' );  // A014577, dots for zeros
//        cout << (p==0 ? '0' : '1' ) << ", ";  // A014577

//        if ( p!=0 )  cout << k << ", ";  // A091072
//        if ( p==0 )  cout << k << ", ";  // A091067
//        if ( p==bit_paper_fold(k) )  cout << k << ", ";  // A091067
//        if ( p!=bit_paper_fold(k) )  cout << k << ", ";  // not in OEIS
//        if ( p < bit_paper_fold(k) )  cout << k << ", ";  // not in OEIS
//        if ( p < bit_paper_fold(k) )  cout << k-1 << ", ";  // not in OEIS
//        if ( p > bit_paper_fold(k) )  cout << k << ", ";  // A047617
//        if ( p > bit_paper_fold(k) )  cout << k-1 << ", ";  // A047461
    }
    cout << endl;

    return 0;
}
// -------------------------


/// Emacs:
/// Local Variables:
/// MyRelDir: "demo/bits"
/// makefile-dir: "../../"
/// make-target: "1demo DSRC=demo/bits/bit-paper-fold-demo.cc"
/// make-target2: "1demo DSRC=demo/bits/bit-paper-fold-demo.cc DEMOFLAGS=-DTIMING"
/// End:

