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

 The Great (Posted on 2013-09-06)
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 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    1610    1811    2412    2713    3214    3615    4816    5417    6418    7219    8120    9621   10822   12823   14424   16225   19226   21627   24328   25629   28830   32431   38432   43233   48634   51235   57636   64837   72938   76839   86440   97241  102442  115243  129644  145845  153646  172847  194448  204849  218750  230451  259252  291653  307254  345655  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

 Search: Search body:
Forums (0)