All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Three odd composite (Posted on 2024-11-08) Difficulty: 3 of 5
How many positive odd integers between 0 and 999 inclusive can be written as sum of 3 odd composite positive integers?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution (spoiler) | Comment 1 of 2
clearvars,clc
had=zeros(1,999);
oddComp=setdiff(3:2:999,primes(999));
idx=combinator(length(oddComp),3,'c');
list=oddComp(idx);
for i=1:length(list)
  s=sum(list(i,:));
  if s<1000 
    had(s)=1;
  end
end
sum(had)

idx=combinator(length(oddComp),2,'p');
list=oddComp(idx);
for i=1:length(list)
  s=list(i,1)*2+list(i,2);
  if s<1000
    if had(s)==0
      fprintf('%d ',s);
    end
    had(s)=1;
  end
end
disp(' ')
sum(had)
 
for i=1:length(oddComp)
  s=3*oddComp(i);
  if s<1000
    if had(s)==0
      fprintf('%d ',s);
    end 
    had(s)=1;
  end
end
disp(' ')
sum(had)

finds

ans =
   476
39 33 43 53  
ans =
   480
27  
ans =
   481


If the three numbers must be unique, there are 476 such numbers; if duplicates are allowed, there are 481 such. The numbers 33, 39, 43 and 53 require that two of the numbers be the same and 27 requires all three the same (of course that's 9).

  Posted by Charlie on 2024-11-08 08:54:32
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information