Puzzle: sequence without multiples of 3 - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Puzzle: sequence without multiples of 3 (/thread-13648.html) |
Puzzle: sequence without multiples of 3 - Albert Chan - 09-13-2019 07:05 PM What is the simplest formula that can generate: 1,2, 4,5, 7,8, 10,11 ... ? In other words, sequence never generate multiples of 3. f(1) = 1, f(2) = 2, f(3) = 4, f(4) = 5, f(5) = 7, f(6) = 8 ... What is f(10^6) ? RE: Puzzle: sequence without multiples of 3 - Voldemar - 09-13-2019 08:57 PM [attachment=7670] RE: Puzzle: sequence without multiples of 3 - Voldemar - 09-13-2019 09:02 PM f(10^6) = (3*333334-2) k=333334 RE: Puzzle: sequence without multiples of 3 - Albert Chan - 09-13-2019 09:43 PM (09-13-2019 09:02 PM)Voldemar Wrote: f(10^6) = (3*333334-2) No, f(k) = k-th numbers from the sequence 1,2, 4,5, 7,8, 10,11, 13,14, ... Example, f(10) = 14 RE: Puzzle: sequence without multiples of 3 - Thomas Okken - 09-14-2019 12:30 AM f(n) = floor((n-1)*1.5)+1 This wouldn't be much of a puzzle if the most obvious formula happened to be the solution, but I thought I'd get it out of the way. As a baseline, if you will. UPDATE to add the answer to the second question: f(10^6) = 1,499,999 RE: Puzzle: sequence without multiples of 3 - John Keith - 09-14-2019 12:54 AM A simple program to generate the sequence, which is A001651: Code:
Returns 2n+1 terms. Not much use to compute f(10^6) though. RE: Puzzle: sequence without multiples of 3 - Albert Chan - 09-14-2019 01:01 AM Hi, Thomas Okken You got it! I saw the formula from a book review, The Irrationals, by Julian Havil The formula itself is trivial, but the procedure to get it can be used for complicated sequences. Example: for non-squares sequence Code: F=n² 1 4 9 16 25 36 49 64 81 This assumed f is non-decreasing function. f* is max k such that f(k) < n, thus we have 2x1, 4x2, 6x3, 8x4 ... → f*(n) = floor(√(n) + 0.5) → non_squares(n) = n + f* = n + floor(√(n) + 0.5) RE: Puzzle: sequence without multiples of 3 - Gerald H - 09-14-2019 05:37 AM INT((3*N-1)/2) for HP 38G. RE: Puzzle: sequence without multiples of 3 - Albert Chan - 09-14-2019 08:29 AM Here is the HP-12C code that produce f(n), f(n) < 10^10 Code: Enter Enter Enter |