Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A327846
Full days remaining in the month on the Gregorian calendar starting at n-th day of a non-leap year.
1
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6
OFFSET
1,1
LINKS
EXAMPLE
On March 27th, the 86th day of the year where n=86, there are 4 full days left in the month of March, a(86)=4.
MATHEMATICA
Array[Range[# - 1, 0, -1] &@ Which[MemberQ[{4, 6, 9, 11}, #], 30, # == 2, 28, True, 31] &, 12] // Flatten (* Michael De Vlieger, Sep 30 2019 *)
PROG
(C++)
#include <iostream>
using namespace std;
int main(){
int m=1;
for(int d=30; m<=12; d--){
cout<<d<<", ";
if(d==0){
m++;
if(m==4||m==6||m==9||m==11)
d=30;
else if(m==2)
d=28;
else
d=31;
}
}
}
CROSSREFS
Sequence in context: A112026 A022986 A023472 * A056998 A057348 A057350
KEYWORD
nonn,fini,full
AUTHOR
Andrew Pham, Sep 27 2019
STATUS
approved