Post Reply 
Puzzle: sequence without multiples of 3
09-13-2019, 07:05 PM (This post was last modified: 09-13-2019 09:44 PM by Albert Chan.)
Post: #1
Puzzle: sequence without multiples of 3
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) ?
Find all posts by this user
Quote this message in a reply
09-13-2019, 08:57 PM
Post: #2
RE: Puzzle: sequence without multiples of 3
   
Find all posts by this user
Quote this message in a reply
09-13-2019, 09:02 PM
Post: #3
RE: Puzzle: sequence without multiples of 3
f(10^6) = (3*333334-2)
k=333334
Find all posts by this user
Quote this message in a reply
09-13-2019, 09:43 PM
Post: #4
RE: Puzzle: sequence without multiples of 3
(09-13-2019 09:02 PM)Voldemar Wrote:  f(10^6) = (3*333334-2)
k=333334

No, f(k) = k-th numbers from the sequence 1,2, 4,5, 7,8, 10,11, 13,14, ...

Example, f(10) = 14
Find all posts by this user
Quote this message in a reply
09-14-2019, 12:30 AM (This post was last modified: 09-14-2019 12:39 AM by Thomas Okken.)
Post: #5
RE: Puzzle: sequence without multiples of 3
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
Find all posts by this user
Quote this message in a reply
09-14-2019, 12:54 AM (This post was last modified: 09-14-2019 11:24 AM by John Keith.)
Post: #6
RE: Puzzle: sequence without multiples of 3
A simple program to generate the sequence, which is A001651:

Code:

\<< \-> n
  \<< 1 1 n
    START DUP 1 + DUP 2 +
    NEXT n 2 * 1 + \->LIST
  \>>
\>>

Returns 2n+1 terms. Not much use to compute f(10^6) though. Smile
Find all posts by this user
Quote this message in a reply
09-14-2019, 01:01 AM (This post was last modified: 09-16-2019 08:13 PM by Albert Chan.)
Post: #7
RE: Puzzle: sequence without multiples of 3
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
n      1  2  3  4  5  6  7  8  9
f=n²-n 0  2  6 12 20 30 42 58 72
f*     1  1  2  2  2  2  3  3  3
n + f* 2  3  5  6  7  8 10 11 12

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)
Find all posts by this user
Quote this message in a reply
09-14-2019, 05:37 AM
Post: #8
RE: Puzzle: sequence without multiples of 3
INT((3*N-1)/2) for HP 38G.
Find all posts by this user
Quote this message in a reply
09-14-2019, 08:29 AM (This post was last modified: 09-14-2019 06:46 PM by Albert Chan.)
Post: #9
RE: Puzzle: sequence without multiples of 3
Here is the HP-12C code that produce f(n), f(n) < 10^10

Code:
Enter Enter Enter
2 / INTG 2 × − Enter ×    ; n%2
2 − + 2 ÷ +               ; f(n) = n + (n + n%2 − 2) / 2
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)