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

Home > Just Math
The Great (Posted on 2013-09-06) Difficulty: 3 of 5
If the members of the set :
S={2x3y : x>=0,y>=0}
are arranged in increasing order we get the sequence beginning
1,2,3,4,6,8,9,12,16,18,......
(a)What is the position of 2a3b in the sequence in terms of a and b.
(b)What is the n-th term of the sequence in terms of n.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution to a, and algorithm for b Comment 2 of 2 |
(In reply to Where to find the sequence by Charlie)

For part a, we can use, from Sloane,

The number of terms less than or equal to n is the Sum_{i = 0…floor(log(3, n))}, floor(log(2, n/3^i) + 1). - Robert G. Wilson v, Aug 17 2012

For part b, we can first get an approximation via

An asymptotic formula for a(n) is roughly : a(n)= 1/sqrt(6) * exp(sqrt(2*log(2)*log(3)*n)). - Benoit Cloitre, Nov 20 2001

also from the Sloane site.

The functions are written as:

FUNCTION term (n)
   approx = INT(EXP(SQR(2 * LOG(2) * LOG(3) * n)) / SQR(6))
   nval = termsLE(approx)
   WHILE nval >= n
     approx = approx - 1
     nval = termsLE(approx)
   WEND
   WHILE nval < n
     approx = approx + 1
     nval = termsLE(approx)
   WEND
   term = approx
END FUNCTION

FUNCTION termsLE (n)
  IF n = 0 THEN termsLE = 0: EXIT FUNCTION
  fudgefactor = .00000000000001#
  top = INT(LOG(n) / LOG(3) + fudgefactor)
  sum = 0
  FOR i = 0 TO top
    sum = sum + INT(LOG(n / 3 ^ i) / LOG(2) + 1 + fudgefactor)
  NEXT
  termsLE = sum
END FUNCTION

The fudge factor is placed there as we are dividing logarithms to get base-2 or base-3 logs, and that inherently imposes the possibility of a slight error, which, if on the low side, could result in taking the INT(), i.e., the floor function, on a number such as 11.99999999998, say, giving an 11 rather than the proper 12.

In finding the nth term, we start with the asymptotic approximation and lower the number until the number of terms less than or equal to the given number is too low. Then we raise one by one until the proper number is achieved.

Using a driver to test:

DEFDBL A-Z
FOR i = 1 TO 55
 PRINT USING "## #####"; i; term(i)
NEXT

we get, in agreement with the list found in Sloane:

 1     1
 2     2
 3     3
 4     4
 5     6
 6     8
 7     9
 8    12
 9    16
10    18
11    24
12    27
13    32
14    36
15    48
16    54
17    64
18    72
19    81
20    96
21   108
22   128
23   144
24   162
25   192
26   216
27   243
28   256
29   288
30   324
31   384
32   432
33   486
34   512
35   576
36   648
37   729
38   768
39   864
40   972
41  1024
42  1152
43  1296
44  1458
45  1536
46  1728
47  1944
48  2048
49  2187
50  2304
51  2592
52  2916
53  3072
54  3456
55  3888

This tests both functions, as the term(n) function invokes the termsLE(n) function in order to home in on the actual answer from the asymptotic approximation.


  Posted by Charlie on 2013-09-09 13:03:14
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