The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A008685 Lengths of months in the Gregorian calendar. 9

%I #35 Feb 04 2024 13:13:17

%S 31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,

%T 31,31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,

%U 30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31

%N Lengths of months in the Gregorian calendar.

%C To make the definition unambiguous, consider these as starting from January 2001 (or, equivalently, AD 1 in the proleptic Gregorian calendar). [_Charles R Greathouse IV_, Sep 28 2011]

%H Charles R Greathouse IV, <a href="/A008685/b008685.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Ca#calendar">Index entries for sequences related to calendars</a>

%H <a href="/index/Rec#order_4800">Index entries for linear recurrences with constant coefficients</a>, order 4800.

%F a(n) = a(n-4800). [_Charles R Greathouse IV_, Sep 28 2011]

%t year1 = 2001; year2 = 2100;

%t PreviousDate[#, "Day"][[1, 3]]& /@ Flatten[Table[{#, m, 1}, {m, Append[ Range[2, 12], 1]}]& /@ Range[year1, year2], 1] (* _Jean-François Alcover_, Aug 01 2018 *)

%o (PARI) v=[];for(n=1,50,v=concat(v,[31, if(n%4||(n%100==0&&n%400),28,29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]));v

%o (Haskell)

%o a008685 n = a008685_list !! (n-1)

%o a008685_list = concatMap t [1..] where

%o t y = [31, 28 + leap, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

%o where leap = if mod y 4 == 0 &&

%o (mod y 100 > 0 || mod y 400 == 0) then 1 else 0

%o -- _Reinhard Zumkeller_, Jun 19 2015

%o (Python)

%o def a(n):

%o y, m = 1 + (n-1)//12, (n-1)%12

%o leap = int((y%4 == 0 and y%100 != 0) or y%400 == 0)

%o return [31, 28+leap, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m]

%o print([a(n) for n in range(1, 64)]) # _Michael S. Branicky_, Feb 04 2024

%Y Cf. A061251.

%K nonn,easy

%O 1,1

%A _N. J. A. Sloane_.

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 19:21 EDT 2024. Contains 373134 sequences. (Running on oeis4.)