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

Home > Numbers
Web Counter (Posted on 2024-06-08) Difficulty: 3 of 5
A certain website has a counter which records the number of hits each day, and keeps a running total. The site gets between 10 and 20 hits, inclusive, per day.

The webmaster noticed that the running total was always prime.

What is the largest number of days the site could be up?
What is the largest number of days if the counter did not start from 1?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts some computer findings | Comment 1 of 3
clearvars
global firstFew mx mxFew
firstFew=[]; mx=0;
for first=[2 3 5 7 11 13 17]
  firstFew=first;
  addon
end

function addon()
global firstFew mx mxFew
  for new=10:20
     
    if isprime(firstFew(end)+new)
      savefirstfew=firstFew;
      firstFew(end+1)=firstFew(end)+new;
      if length(firstFew)> mx
        mx=length(firstFew);
        mxFew=firstFew;
      end
      addon;
      firstFew=savefirstfew;
    end
     
  end
end

ran very slowly.  The farthest I got was 84 (days) long:

   2   13   23   37   47   59   71   83   97  107  127  137  149  163  173  191  211  223  233  251  263  277  293  307  317  331  347  359  373  383  397  409  419  431  443  457  467  479  491  503  521  541  557  569  587  599  613  631  641  653  673  683  701  719  733  743  757  769  787  797  809  821  839  853  863  877  887  907  919  929  941  953  967  977  991 1009 1019 1031 1049 1069 1087 1097 1109 1123

based on stopping the program and checking:

K>> fprintf('%5d',mxFew)
    2   13   23   37   47   59   71   83   97  107  127  137  149  163  173  191  211  223  233  251  263  277  293  307  317  331  347  359  373  383  397  409  419  431  443  457  467  479  491  503  521  541  557  569  587  599  613  631  641  653  673  683  701  719  733  743  757  769  787  797  809  821  839  853  863  877  887  907  919  929  941  953  967  977  991 1009 1019 1031 1049 1069 1087 1097 1109 1123



K>> disp(length(mxFew))
    84
K>> 

I'll try a different approach.

  Posted by Charlie on 2024-06-08 11:57:36
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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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