JSFiddle - React, Tailwind, and code Playground

JavaScript

tic = 1325376000; // UNIX time on January 1st, 2012 (0:0:0)
toc = 1325462400; // UNIX time on January 2nd, 2012 (0:0:0)

DD017 = Math.round(86400/17);  // 1 day divided by 17  (in seconds)
DD217 = Math.round(86400/217); // 1 day divided by 217 (in seconds)

// Item A recieves 17 votes during the day
pA = tic; // pA is the popularity value for item A
for (i = tic; i < toc; i += DD017) {
    pA = (pA + i)/2;
}

// Item B recieves 217 votes during the day
pB = tic; // pB is the popularity value for item B
for (i = tic; i < toc; i += DD217) {
    pB = (pB + i)/2;
}

if (pA > pB) {
    alert("Item A (17 votes) has a higher popularity by " + Math.round(pA - pB));
}

if (pB > pA) {
    alert("Item B (217 votes) has a higher popularity by " + Math.round(pB - pA));
}