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

Home > General
Chinese New Year (Posted on 2015-01-16) Difficulty: 3 of 5

Chinese New Year (CNY) falls on 19th February this year. That's an unusually late date; CNY generally falls around the beginning of February.

CNY can also fall on 20th February, though that's only happened once in my lifetime.

a. When will CNY next fall on 20th February?
b. Can CNY ever fall on 21st February? If so, when will that happen next?

See The Solution Submitted by broll    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re(2): computer solution -- the JavaScript code | Comment 7 of 8 |
(In reply to re: computer solution -- the JavaScript code by Charlie)

I just remembered that I had the Chinese New Year program also in Basic (Mintoris Basic, whose interpreter is an Android App).  I made the same modification there, and the results were the same:

degree
Open 1,"chinese ny puzz.txt","w"
DIM animal$(12) = "","Rat",  "Ox", "Tiger", "Rabbit(Hare)", "Dragon", "Snake", "Horse", "Sheep(Goat)", "Monkey", "Rooster", "Dog", "Boar(Pig)"
dim mName$(12) = "","Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."

yr0=val(formattime$(time(),"yyyy"))
edit yr0
for y=yr0-1 to yr0+2000
  jdn = chineseNY(y)
  mdy(jdn, &m, &d, &y)

  c = (y - 3) MOD 12
  IF c = 0 THEN c = 12
  if m=2 and d>19 then writeln 1, "Year of the "+animal$(c)+ " begins "+mName$(m)+str$(d)+ ", "+str$(y)
next y
close 1
print "done"
end
sub chineseNY(y)
  IF y < 1928 THEN
    chTZ = -(465 + 40 / 60) / 60
  ELSE
    chTZ = -8
  endif
  s1 = wSolst(y - 1, chTZ)
  s2 = wSolst(y, chTZ)
  solT1 = solTerm(y, chTZ, 300)
  solT2 = solTerm(y, chTZ, 330)
  m1 = nextNewMoon(s1, chTZ)
  m2 = nextNewMoon(m1, chTZ)
  m3 = nextNewMoon(m2, chTZ)
  m11 = nextNewMoon(nextNewMoon(s2, chTZ) - 33, chTZ)

  chinNY = m2
  IF INT((m11 - m1) / 29.530588 + .5) = 12 THEN
    IF solT1 >= m2 OR solT2 >= m3 THEN chinNY = m3
  endif
  return chinNY
  
END sub



SUB mdy(jdNum, m, d, y)
  DIM cw(8)
  IF jdNum > 2299160 THEN 
    GOTO 10200
  ELSE
    GOTO 10250
  ENDIF  

10200 REM  noon jd-->greg mo/da/ye
10210 cw(0) = INT((jdNum - 1867216.25) / 36524.25)
10220 cw(0) = jdNum + 1 + cw(0) - INT(cw(0) / 4)
10230 GOTO 10260
10240 REM   noon jd-->jul mo/da/ye
10250 cw(0) = jdNum
10260 cw(0) = cw(0) + 1524
10265 cw(1) = INT((cw(0) - 122.1) / 365.25)
10270 cw(2) = INT(365.25 * cw(1))
10275 cw(3) = INT((cw(0) - cw(2)) / 30.6001)
10280 da = cw(0) - cw(2) - INT(30.61 * cw(3))
10285 ye = cw(1) - 4716
10290 mo = cw(3) - 1
IF mo > 12 THEN 
 mo = mo - 12
 ye = ye + 1
endif 
10295   m = mo
    d = da
    y = ye
END SUB

sub nextNewMoon(j1, chTZ)
    d = j1 - 2415020
    t = d / 36525
    k = (j1 - 2415020.759) / 29.53058868
    k = INT(k) - 1
    DO
     m = fnnm(359.22 + 29.10535608 * k)
     mp = fnnm(306.03 + 385.8169181 * k + .01073 * t * t + .00001236 * t * t * t)
     F = fnnm(21.2964 + 390.67050646 * k - .0016528 * t * t)

     jdNo = 2415020.75933 + 29.53058868 * k + .0001178 * t * t
     jdNo = jdNo + .1734 * sin(m)
     jdNo = jdNo + .0021 * sin(2 * m)
     jdNo = jdNo - .4068 * sin(mp)
     jdNo = jdNo + .0161 * sin(2 * mp)
     jdNo = jdNo + .0104 * sin(2 * F)
     jdNo = jdNo - .0051 * sin(m + mp)
     jdNo = jdNo - .0074 * sin(m - mp)
     jdNo = jdNo + .001 * sin(2 * F - mp)

     jdNo = jdNo - (.41 + 1.2053 * t + .4992 * t * t) / 1440
     jdNo = jdNo - chTZ / 24
     jdNo = INT(jdNo + .5)

     k = k + 1
    LOOP UNTIL jdNo > j1
    return jdNo
END sub

sub solTerm(y, chTZ, LO)
    IF LO >= 270 THEN 
      ys = y - 1
    ELSE 
      ys = y
    endif  
    t = (365.2422 * (ys + LO / 360) - 693878.7) / 36525
    PE = .00134 * cos(22518.7541 * t + 153)
    PE = PE + .00154 * cos(45037.5082 * t + 217) + .002 * cos(32964.3577 * t + 313) + .00178 * sin(20.2 * t + 231)
    DO
      L = 279.6967 + 36000.76892 * t + .0003025 * t * t
      m = 358.476 + 35999.04975 * t - .00015 * t * t - .0000033 * t * t * t
      L = L + (1.91946 - .004789 * t - .000014 * t * t) * sin(m) + (.020094 - .0001 * t) * sin(2 * m) + .000293 * sin(3 * m)
      L = L - .00479 * sin(fnnm(259.18 - 1934.142 * t)) - .00569 + PE + .00179 * sin(351 + 445267.1142 * t - .00144 * t * t)
      L = fnnm(L)
      DT = (fnnm(LO - L + 180) - 180) / 36525
      t = t + DT
    LOOP WHILE ABS(DT * 36525) > .001
    chJD = t * 36525 + 2415020 - (.41 + 1.2053 * t + .4992 * t * t) / 1440 - chTZ / 24
    return INT(chJD + .5)
END sub

sub wSolst(ys, chTZ) 'chTZ in hours; + = west
    LO = 270
    t = (365.2422 * (ys + LO / 360) - 693878.7) / 36525
    PE = .00134 * cos(22518.7541 * t + 153)
    PE = PE + .00154 * cos(45037.5082 * t + 217) + .002 * cos(32964.3577 * t + 313) + .00178 * sin(20.2 * t + 231)
    DO
      L = 279.6967 + 36000.76892 * t + .0003025 * t * t
      m = 358.476 + 35999.04975 * t - .00015 * t * t - .0000033 * t * t * t
      L = L + (1.91946 - .004789 * t - .000014 * t * t) * sin(m) + (.020094 - .0001 * t) * sin(2 * m) + .000293 * sin(3 * m)
      L = L - .00479 * sin(fnnm(259.18 - 1934.142 * t)) - .00569 + PE + .00179 * sin(351 + 445267.1142 * t - .00144 * t * t)
      L = fnnm(L)
      DT = (fnnm(LO - L + 180) - 180) / 36525
      t = t + DT
    LOOP WHILE ABS(DT * 36525) > .001
    chJD = t * 36525 + 2415020 - (.41 + 1.2053 * t + .4992 * t * t) / 1440 - chTZ / 24
    return INT(chJD + .5)
END sub

sub fnnm(x)
return x - 360 * INT(x / 360)
end sub

Year of the Monkey begins Feb.20, 1920
Year of the Ox begins Feb.20, 1985
Year of the Monkey begins Feb.20, 2148
Year of the Rabbit(Hare) begins Feb.20, 2167
Year of the Snake begins Feb.20, 2205
Year of the Rat begins Feb.20, 2224
Year of the Sheep(Goat) begins Feb.20, 2243
Year of the Boar(Pig) begins Feb.21, 2319
Year of the Sheep(Goat) begins Feb.20, 2615
Year of the Ox begins Feb.20, 2729
Year of the Rabbit(Hare) begins Feb.20, 2911
Year of the Dog begins Feb.20, 2930
Year of the Boar(Pig) begins Feb.20, 3063
Year of the Horse begins Feb.20, 3082
Year of the Rat begins Feb.20, 3112
Year of the Sheep(Goat) begins Feb.20, 3131
Year of the Monkey begins Feb.20, 3264
Year of the Dog begins Feb.20, 3302
Year of the Rat begins Feb.20, 3340
Year of the Dragon begins Feb.21, 3416
Year of the Horse begins Feb.20, 3454
Year of the Sheep(Goat) begins Feb.20, 3503
Year of the Tiger begins Feb.20, 3522
Year of the Monkey begins Feb.20, 3636
Year of the Rat begins Feb.20, 3712
Year of the Sheep(Goat) begins Feb.20, 3731
Year of the Dragon begins Feb.20, 3788
Year of the Boar(Pig) begins Feb.20, 3807
Year of the Horse begins Feb.20, 3826


  Posted by Charlie on 2015-01-17 12:14:08
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 (10)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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