Cody

# Problem 1319. Leap years on other planets

Solution 304755

Submitted on 15 Aug 2013 by Erin
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
N={'Mercury','Venus','Earth','Mars','Jupiter',... 'Saturn','Uranus','Neptune','Pluto'}; P=[0.5000 1.9246 365.2425 668.5950 10471.0182 ... 24204.8198 42582.9327 89087.3743 14183.7398]; for i=1:9 p=P(i); m=leapsequence(p); n=numel(m); r=dot(1./m,(-1).^(0:n-1)); disp([N{i} ' p=' num2str(p,'%0.6f') ... ' r=' num2str(r,'%0.6f') ' m=' mat2str(m)]) assert(abs(floor(p)+r-p)<=0.00005); assert(all(m>0)) assert(all(mod(m,1)==0)) assert(all(mod([m 0],[1 m])==0)) end

N = 0 m = 2 no_leap = 0.5000 X = 0.5000 Mercury p=0.500000 r=0.500000 m=2 N = 1 m = 1 no_leap = 1 X = 2 Venus p=1.924600 r=0.924600 m=[1 13 650 65000] N = 365 m = 4 no_leap = 0.2500 X = 365.2500 Earth p=365.242500 r=0.242500 m=[4 132 13200] N = 668 m = 1 no_leap = 1 X = 669 Mars p=668.595000 r=0.595000 m=[1 2 10 200] N = 10471 m = 54 no_leap = 0.0185 X = 1.0471e+04 Jupiter p=10471.018200 r=0.018199 m=[54 3132] N = 24204 m = 1 no_leap = 1 X = 24205 Saturn p=24204.819800 r=0.819800 m=[1 5 50 5000] N = 42582 m = 1 no_leap = 1 X = 42583 Uranus p=42582.932700 r=0.932699 m=[1 14 238 13566] N = 89087 m = 2 no_leap = 0.5000 X = 8.9088e+04 Neptune p=89087.374300 r=0.374294 m=[2 6 24 1416] N = 14183 m = 1 no_leap = 1 X = 14184 Pluto p=14183.739800 r=0.739800 m=[1 3 12 96 4608]