Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807036
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:55:40+00:00 2026-05-19T14:55:40+00:00

I am trying to write all the 6-bit permutations of 0s and 1s using

  • 0

I am trying to write all the 6-bit permutations of 0s and 1s using recursion (i.e., [0 0 0 0 0 1], [0 0 0 0 1 0], [0 0 0 0 1 1], [0 0 0 1 0 0], … [1 1 1 1 1 1]). I’m following a tip I got from Yahoo! Answers I’ve got the following but it just doesn’t go all the way to the end and there are duplicate entries.

function [c] = myIEEEBaby_all_decimals(h, n)

% n: number of characters more to add

if n == 0
   converter(h);
   return 
end

in1 = [h 1];
in2 = [h 0];

converter(in1);
converter(in2);

if length(h) < n
    myIEEEBaby_all_decimals([in1], n-1)
    myIEEEBaby_all_decimals([in2], n-1)
end

end

function [d] = converter(IEEE)
% convert custom IEEE representation to decimal

IEEE = [zeros(1,6-length(IEEE)), IEEE];

s = IEEE(1);

characteristic = IEEE([2,3]);
k = find(fliplr(characteristic)) - 1;
c = sum(2.^k);

fraction = IEEE([4:6]);
f = sum(2.^-(find(fliplr(fraction))));

d = (-1)^s*2^(c-1)*(1+f);

disp([num2str(IEEE),' : ', num2str(d)]);

end

The output (MATLAB) is just:

>> myIEEEBaby_all_decimals([],6)
0  0  0  0  0  1 : 0.75
0  0  0  0  0  0 : 0.5
0  0  0  0  1  1 : 0.875
0  0  0  0  1  0 : 0.625
0  0  0  1  1  1 : 0.9375
0  0  0  1  1  0 : 0.6875
0  0  1  1  1  1 : 1.875
0  0  1  1  1  0 : 1.375
0  0  1  1  0  1 : 1.625
0  0  1  1  0  0 : 1.125
0  0  0  1  0  1 : 0.8125
0  0  0  1  0  0 : 0.5625
0  0  1  0  1  1 : 1.75
0  0  1  0  1  0 : 1.25
0  0  1  0  0  1 : 1.5
0  0  1  0  0  0 : 1
0  0  0  0  0  1 : 0.75
0  0  0  0  0  0 : 0.5
0  0  0  0  1  1 : 0.875
0  0  0  0  1  0 : 0.625
0  0  0  1  1  1 : 0.9375
0  0  0  1  1  0 : 0.6875
0  0  0  1  0  1 : 0.8125
0  0  0  1  0  0 : 0.5625
0  0  0  0  0  1 : 0.75
0  0  0  0  0  0 : 0.5
0  0  0  0  1  1 : 0.875
0  0  0  0  1  0 : 0.625
0  0  0  0  0  1 : 0.75
0  0  0  0  0  0 : 0.5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:55:40+00:00Added an answer on May 19, 2026 at 2:55 pm

    Simply iterate from 0 to 26-1 and call Matlab’s dec2bin(...) function. You could pad the result with zero’s using sprintf(...).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all I am trying to write a script which recursively searches directories from
I'm trying to write a method that removes all non alphabetic characters from a
I'm trying to write a method that will compute all permutations of a power
I'm trying to write a bit of jquery which finds all h2 tags inside
Guys I'm a bit new in using java and i'm trying to write a
I'm a bit new to python, but familiar with OOP. I'm trying to write
I've spent all morning trying to write what I thought was a simple bit
I'm trying to write a library to separate all the disk activity out into
I'm trying to write some code to catch all Errors and ErrorEvents however i
I was trying to write a function to get all subsequences of a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.