Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -8,7 +8,8 @@ So in the following table:
|
|||
...</pre>
|
||||
The binary number "<code>10</code>" is <math>1 \times 2^1 + 0 \times 2^0</math>.
|
||||
|
||||
You can have binary digits to the right of the “point” just as in the decimal number system too. in this case, the digit in the place immediately to the right of the point has a weight of <math>2^{-1}</math>, or <math>1/2</math>. The weight for the second column to the right of the point is <math>2^{-2}</math> or <math>1/4</math>. And so on.
|
||||
You can have binary digits to the right of the “point” just as in the decimal number system too. in this case, the digit in the place immediately to the right of the point has a weight of <math>2^{-1}</math>, or <math>1/2</math>.
|
||||
The weight for the second column to the right of the point is <math>2^{-2}</math> or <math>1/4</math>. And so on.
|
||||
|
||||
If you take the integer binary count of the first table, and ''reflect'' the digits about the binary point, you end up with '''the van der Corput sequence of numbers in base 2'''.
|
||||
|
||||
|
|
|
|||
127
Task/Van-der-Corput-sequence/C-sharp/van-der-corput-sequence.cs
Normal file
127
Task/Van-der-Corput-sequence/C-sharp/van-der-corput-sequence.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace VanDerCorput
|
||||
{
|
||||
/// <summary>
|
||||
/// Computes the Van der Corput sequence for any number base.
|
||||
/// The numbers in the sequence vary from zero to one, including zero but excluding one.
|
||||
/// The sequence possesses low discrepancy.
|
||||
/// Here are the first ten terms for bases 2 to 5:
|
||||
///
|
||||
/// base 2: 0 1/2 1/4 3/4 1/8 5/8 3/8 7/8 1/16 9/16
|
||||
/// base 3: 0 1/3 2/3 1/9 4/9 7/9 2/9 5/9 8/9 1/27
|
||||
/// base 4: 0 1/4 1/2 3/4 1/16 5/16 9/16 13/16 1/8 3/8
|
||||
/// base 5: 0 1/5 2/5 3/5 4/5 1/25 6/25 11/25 16/25 21/25
|
||||
/// </summary>
|
||||
/// <see cref="http://rosettacode.org/wiki/Van_der_Corput_sequence"/>
|
||||
public class VanDerCorputSequence: IEnumerable<Tuple<long,long>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Number base for the sequence, which must bwe two or more.
|
||||
/// </summary>
|
||||
public int Base { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of terms to be returned by iterator.
|
||||
/// </summary>
|
||||
public long Count { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Construct a sequence for the given base.
|
||||
/// </summary>
|
||||
/// <param name="iBase">Number base for the sequence.</param>
|
||||
/// <param name="count">Maximum number of items to be returned by the iterator.</param>
|
||||
public VanDerCorputSequence(int iBase, long count = long.MaxValue) {
|
||||
if (iBase < 2)
|
||||
throw new ArgumentOutOfRangeException("iBase", "must be two or greater, not the given value of " + iBase);
|
||||
Base = iBase;
|
||||
Count = count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compute nth term in the Van der Corput sequence for the base specified in the constructor.
|
||||
/// </summary>
|
||||
/// <param name="n">The position in the sequence, which may be zero or any positive number.</param>
|
||||
/// This number is always an integral power of the base.</param>
|
||||
/// <returns>The Van der Corput sequence value expressed as a Tuple containing a numerator and a denominator.</returns>
|
||||
public Tuple<long,long> Compute(long n)
|
||||
{
|
||||
long p = 0, q = 1;
|
||||
long numerator, denominator;
|
||||
while (n != 0)
|
||||
{
|
||||
p = p * Base + (n % Base);
|
||||
q *= Base;
|
||||
n /= Base;
|
||||
}
|
||||
numerator = p;
|
||||
denominator = q;
|
||||
while (p != 0)
|
||||
{
|
||||
n = p;
|
||||
p = q % p;
|
||||
q = n;
|
||||
}
|
||||
numerator /= q;
|
||||
denominator /= q;
|
||||
return new Tuple<long,long>(numerator, denominator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compute nth term in the Van der Corput sequence for the given base.
|
||||
/// </summary>
|
||||
/// <param name="iBase">Base to use for the sequence.</param>
|
||||
/// <param name="n">The position in the sequence, which may be zero or any positive number.</param>
|
||||
/// <returns>The Van der Corput sequence value expressed as a Tuple containing a numerator and a denominator.</returns>
|
||||
public static Tuple<long, long> Compute(int iBase, long n)
|
||||
{
|
||||
var seq = new VanDerCorputSequence(iBase);
|
||||
return seq.Compute(n);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Iterate over the Van Der Corput sequence.
|
||||
/// The first value in the sequence is always zero, regardless of the base.
|
||||
/// </summary>
|
||||
/// <returns>A tuple whose items are the Van der Corput value given as a numerator and denominator.</returns>
|
||||
public IEnumerator<Tuple<long, long>> GetEnumerator()
|
||||
{
|
||||
long iSequenceIndex = 0L;
|
||||
while (iSequenceIndex < Count)
|
||||
{
|
||||
yield return Compute(iSequenceIndex);
|
||||
iSequenceIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
TestBasesTwoThroughFive();
|
||||
|
||||
Console.WriteLine("Type return to continue...");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
static void TestBasesTwoThroughFive()
|
||||
{
|
||||
foreach (var seq in Enumerable.Range(2, 5).Select(x => new VanDerCorputSequence(x, 10))) // Just the first 10 elements of the each sequence
|
||||
{
|
||||
Console.Write("base " + seq.Base + ":");
|
||||
foreach(var vc in seq)
|
||||
Console.Write(" " + vc.Item1 + "/" + vc.Item2);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Task/Van-der-Corput-sequence/C/van-der-corput-sequence.c
Normal file
35
Task/Van-der-Corput-sequence/C/van-der-corput-sequence.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void vc(int n, int base, int *num, int *denom)
|
||||
{
|
||||
int p = 0, q = 1;
|
||||
|
||||
while (n) {
|
||||
p = p * base + (n % base);
|
||||
q *= base;
|
||||
n /= base;
|
||||
}
|
||||
|
||||
*num = p;
|
||||
*denom = q;
|
||||
|
||||
while (p) { n = p; p = q % p; q = n; }
|
||||
*num /= q;
|
||||
*denom /= q;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int d, n, i, b;
|
||||
for (b = 2; b < 6; b++) {
|
||||
printf("base %d:", b);
|
||||
for (i = 0; i < 10; i++) {
|
||||
vc(i, b, &n, &d);
|
||||
if (n) printf(" %d/%d", n, d);
|
||||
else printf(" 0");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
(defn van-der-corput
|
||||
"Get the nth element of the van der Corput sequence."
|
||||
([n]
|
||||
;; Default base = 2
|
||||
(van-der-corput n 2))
|
||||
([n base]
|
||||
(let [s (/ 1 base)] ;; A multiplicand to shift to the right of the decimal.
|
||||
;; We essentially want to reverse the digits of n and put them after the
|
||||
;; decimal point. So, we repeatedly pull off the lowest digit of n, scale
|
||||
;; it to the right of the decimal point, and accumulate that.
|
||||
(loop [sum 0
|
||||
n n
|
||||
scale s]
|
||||
(if (zero? n)
|
||||
sum ;; Base case: no digits left, so we're done.
|
||||
(recur (+ sum (* (rem n base) scale)) ;; Accumulate the least digit
|
||||
(quot n base) ;; Drop a digit of n
|
||||
(* scale s))))))) ;; Move farther past the decimal
|
||||
|
||||
(clojure.pprint/print-table
|
||||
(cons :base (range 10)) ;; column headings
|
||||
(for [base (range 2 6)] ;; rows
|
||||
(into {:base base}
|
||||
(for [n (range 10)] ;; table entries
|
||||
[n (van-der-corput n base)]))))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
(defun van-der-Corput (n base)
|
||||
(loop for d = 1 then (* d base) while (<= d n)
|
||||
finally
|
||||
(return (/ (parse-integer
|
||||
(reverse (write-to-string n :base base))
|
||||
:radix base)
|
||||
d))))
|
||||
|
||||
(loop for base from 2 to 5 do
|
||||
(format t "Base ~a: ~{~6a~^~}~%" base
|
||||
(loop for i to 10 collect (van-der-Corput i base))))
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import std.stdio, std.algorithm, std.range;
|
||||
|
||||
double vdc(int n, in double base=2.0) pure nothrow {
|
||||
double vdc(int n, in double base=2.0) pure nothrow @safe @nogc {
|
||||
double vdc = 0.0, denom = 1.0;
|
||||
while (n) {
|
||||
denom *= base;
|
||||
|
|
@ -11,6 +9,8 @@ double vdc(int n, in double base=2.0) pure nothrow {
|
|||
}
|
||||
|
||||
void main() {
|
||||
foreach (b; 2 .. 6)
|
||||
writeln("\nBase ", b, ": ", iota(10).map!(n => vdc(n, b))());
|
||||
import std.stdio, std.algorithm, std.range;
|
||||
|
||||
foreach (immutable b; 2 .. 6)
|
||||
writeln("\nBase ", b, ": ", 10.iota.map!(n => vdc(n, b)));
|
||||
}
|
||||
|
|
|
|||
13
Task/Van-der-Corput-sequence/Lua/van-der-corput-sequence.lua
Normal file
13
Task/Van-der-Corput-sequence/Lua/van-der-corput-sequence.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function vdc(n, base)
|
||||
local digits = {}
|
||||
while n ~= 0 do
|
||||
local m = math.floor(n / base)
|
||||
table.insert(digits, n - m * base)
|
||||
n = m
|
||||
end
|
||||
m = 0
|
||||
for p, d in pairs(digits) do
|
||||
m = m + math.pow(base, -p) * d
|
||||
end
|
||||
return m
|
||||
end
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
Program VanDerCorput;
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}
|
||||
{$ELSE}
|
||||
{$APPTYPE CONSOLE}
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
tvdrCallback = procedure (nom,denom: NativeInt);
|
||||
|
||||
{ Base=2
|
||||
function rev2(n,Pot:NativeUint):NativeUint;
|
||||
var
|
||||
r : Nativeint;
|
||||
begin
|
||||
r := 0;
|
||||
while Pot > 0 do
|
||||
Begin
|
||||
r := r shl 1 OR (n AND 1);
|
||||
n := n shr 1;
|
||||
dec(Pot);
|
||||
end;
|
||||
rev2 := r;
|
||||
end;
|
||||
}
|
||||
|
||||
function reverse(n,base,Pot:NativeUint):NativeUint;
|
||||
var
|
||||
r,c : Nativeint;
|
||||
begin
|
||||
r := 0;
|
||||
//No need to test n> 0 in this special case, n starting in upper half
|
||||
while Pot > 0 do
|
||||
Begin
|
||||
c := n div base;
|
||||
r := n+(r-c)*base;
|
||||
n := c;
|
||||
dec(Pot);
|
||||
end;
|
||||
reverse := r;
|
||||
end;
|
||||
|
||||
procedure VanDerCorput(base,count:NativeUint;f:tvdrCallback);
|
||||
//calculates count nominater and denominater of Van der Corput sequence
|
||||
// to base
|
||||
var
|
||||
Pot,
|
||||
denom,nom,
|
||||
i : NativeUint;
|
||||
Begin
|
||||
denom := 1;
|
||||
Pot := 0;
|
||||
while count > 0 do
|
||||
Begin
|
||||
IF Pot = 0 then
|
||||
f(0,1);
|
||||
//start in upper half
|
||||
i := denom;
|
||||
inc(Pot);
|
||||
denom := denom *base;
|
||||
|
||||
repeat
|
||||
nom := reverse(i,base,Pot);
|
||||
IF count > 0 then
|
||||
f(nom,denom)
|
||||
else
|
||||
break;
|
||||
inc(i);
|
||||
dec(count);
|
||||
until i >= denom;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure vdrOutPut(nom,denom: NativeInt);
|
||||
Begin
|
||||
write(nom,'/',denom,' ');
|
||||
end;
|
||||
|
||||
var
|
||||
i : NativeUint;
|
||||
Begin
|
||||
For i := 2 to 5 do
|
||||
Begin
|
||||
write(' Base ',i:2,' :');
|
||||
VanDerCorput(i,9,@vdrOutPut);
|
||||
writeln;
|
||||
end;
|
||||
end.
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
/*REXX pgm converts any integer (or a range) to a van der Corput number in base 2*/
|
||||
/*convert any integer (or a range) to a van der Corput number in base 2*/
|
||||
|
||||
/*REXX pgm converts an integer (or a range)──►van der Corput # in base 2*/
|
||||
numeric digits 1000 /*handle anything the user wants.*/
|
||||
parse arg a b . /*obtain the number(s) [maybe]. */
|
||||
if a=='' then do; a=0; b=10; end /*if none specified, use defaults*/
|
||||
if b=='' then b=a /*assume a "range" of a single #.*/
|
||||
if a=='' then do; a=0; b=10; end /*if none specified, use defaults*/
|
||||
if b=='' then b=a /*assume a "range" of a single #.*/
|
||||
|
||||
do j=a to b /*traipse through the range. */
|
||||
_=vdC(abs(j)) /*convert abs value of integer. */
|
||||
leading=substr('-',2+sign(j)) /*if needed, leading minus sign. */
|
||||
do j=a to b /*traipse through the range. */
|
||||
_=vdC(abs(j)) /*convert ABS value of integer.*/
|
||||
leading=substr('-',2+sign(j)) /*if needed, elide leading sign.*/
|
||||
say leading || _ /*show number (with leading - ?)*/
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────VDC [van der Corput] subroutine─────*/
|
||||
vdC: procedure; y=x2b(d2x(arg(1))) /*convert to hex, then binary. */
|
||||
if y=0 then return 0 /*zero has been converted to 0000*/
|
||||
else return '.'reverse(strip(y,"L",0)) /*heavy lifting by REXX*/
|
||||
vdC: procedure; y=x2b(d2x(arg(1)))+0 /*convert to hex, then binary. */
|
||||
if y==0 then return 0 /*handle special case of zero. */
|
||||
else return '.'reverse(y) /*heavy lifting by REXX*/
|
||||
|
|
|
|||
|
|
@ -1,28 +1,23 @@
|
|||
/*REXX pgm converts any integer (or a range) to a van der Corput number in base 2,*/
|
||||
/* or optionaly, any other base up to base 90. */
|
||||
/*If the base is negative, the output is shown as a list. */
|
||||
|
||||
/*REXX pgm converts an integer (or a range) ──► van der Corput number */
|
||||
/*in base 2, or optionally, any other base up to and including base 90.*/
|
||||
numeric digits 1000 /*handle anything the user wants.*/
|
||||
parse arg a b r . /*obtain the number(s) [maybe]. */
|
||||
if a=='' then do; a=0; b=10; end /*if none specified, use defaults*/
|
||||
if b=='' then b=a /*assume a "range" of a single #.*/
|
||||
if r=='' then r=2 /*assume a radix (base) of 2. */
|
||||
if a=='' then do; a=0; b=10; end /*if none specified, use defaults*/
|
||||
if b=='' then b=a /*assume a "range" of a single #.*/
|
||||
if r=='' then r=2 /*assume a radix (base) of 2. */
|
||||
z= /*placeholder for a list of nums.*/
|
||||
|
||||
do j=a to b /*traipse through the range. */
|
||||
_=vdC(abs(j),abs(r)) /*convert abs value of integer. */
|
||||
_=substr('-',2+sign(j))_ /*if needed, leading minus sign. */
|
||||
if r>0 then say _ /*if positive base, just show it.*/
|
||||
else z=z _ /* ... else build a list. */
|
||||
do j=a to b /*traipse through the range. */
|
||||
_=vdC(abs(j), abs(r)) /*convert ABS value of integer.*/
|
||||
_=substr('-', 2+sign(j))_ /*if needed, keep leading - sign.*/
|
||||
if r>0 then say _ /*if positive base, just show it.*/
|
||||
else z=z _ /* ··· else build a list· */
|
||||
end /*j*/
|
||||
|
||||
if z\=='' then say strip(z) /*if list wanted, then show it. */
|
||||
if z\=='' then say strip(z) /*if list wanted, then show it. */
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────VDC [van der Corput] subroutine─────*/
|
||||
vdC: return '.'reverse(base(arg(1),arg(2))) /*convert, reverse, append.*/
|
||||
/*──────────────────────────────────BASE subroutine (up to base 90)─────*/
|
||||
base: procedure; parse arg x,toB,inB /*get a number, toBase, inBase */
|
||||
|
||||
/*┌────────────────────────────────────────────────────────────────────┐
|
||||
┌─┘ Input to this subroutine (all must be positive whole numbers): └─┐
|
||||
│ │
|
||||
|
|
@ -33,32 +28,29 @@ base: procedure; parse arg x,toB,inB /*get a number, toBase, inBase */
|
|||
│ toBase or inBase can be omitted which causes the default of │
|
||||
└─┐ 10 to be used. The limits of both are: 2 ──► 90. ┌─┘
|
||||
└────────────────────────────────────────────────────────────────────┘*/
|
||||
|
||||
@abc='abcdefghijklmnopqrstuvwxyz' /*random characters, sorted. */
|
||||
@abcU=@abc; upper @abcU /*go whole hog and extend 'em. */
|
||||
@@@=0123456789||@abc||@abcU /*prefix 'em with numeric digits.*/
|
||||
@@@=@@@'<>[]{}()?~!@#$%^&*_+-=|\/;:~' /*add some special chars as well.*/
|
||||
@abc='abcdefghijklmnopqrstuvwxyz' /*Latin lowercase alphabet chars.*/
|
||||
@abcU=@abc; upper @abcU /*go whole hog and extend chars. */
|
||||
@@@=0123456789 || @abc || @abcU /*prefix 'em with numeric digits.*/
|
||||
@@@=@@@'<>[]{}()?~!@#$%^&*_+-=|\/;:~' /*add some special chars as well,*/
|
||||
/*spec. chars should be viewable.*/
|
||||
numeric digits 1000 /*what the hey, support biggies. */
|
||||
maxB=length(@@@) /*max base (radix) supported here*/
|
||||
parse arg x,toB,inB /*get a number, toBase, inBase */
|
||||
if toB=='' then toB=10 /*if skipped, assume default (10)*/
|
||||
if inB=='' then inB=10 /* " " " " " */
|
||||
|
||||
if toB=='' then toB=10 /*if skipped, assume default (10)*/
|
||||
if inB=='' then inB=10 /* " " " " " */
|
||||
/*══════════════════════════════════convert X from base inB ──► base 10.*/
|
||||
#=0
|
||||
do j=1 for length(x)
|
||||
_=substr(x,j,1) /*pick off a "digit" from X. */
|
||||
v=pos(_,@@@) /*get the value of this "digits".*/
|
||||
if v==0 |v>inB then call erd x,j,inB /*illegal "digit"? */
|
||||
#=#*inB+v-1 /*construct new num, dig by dig. */
|
||||
end /*j*/
|
||||
|
||||
#=0; do j=1 for length(x)
|
||||
_=substr(x,j,1) /*pick off a "digit" from X. */
|
||||
v=pos(_,@@@) /*get the value of this "digits".*/
|
||||
if v==0 | v>inB then call erd x,j,inB /*illegal "digit" ? */
|
||||
#=#*inB + v - 1 /*construct new num, dig by dig. */
|
||||
end /*j*/
|
||||
/*══════════════════════════════════convert # from base 10 ──► base toB.*/
|
||||
y=
|
||||
do while #>=toB /*deconstruct the new number (#).*/
|
||||
y=substr(@@@,(#//toB)+1,1)y /*construnct the output number. */
|
||||
#=#%toB /*... and whittle # down also. */
|
||||
end /*while*/
|
||||
y=; do while #>=toB /*deconstruct the new number (#).*/
|
||||
y=substr(@@@,(#//toB)+1,1)y /* construct the output number. */
|
||||
#=# % toB /*··· and whittle # down also. */
|
||||
end /*while*/
|
||||
|
||||
return substr(@@@,#+1,1)y
|
||||
/*──────────────────────────────────VDC [van der Corput] subroutine─────*/
|
||||
vdC: return '.'reverse(base(arg(1),arg(2))) /*convert, reverse, append.*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
def vdc(n, base=2)
|
||||
str = n.to_s(base).reverse
|
||||
str.to_i(base).quo(base ** str.length)
|
||||
end
|
||||
|
||||
(2..5).each do |base|
|
||||
puts "Base #{base}: " + Array.new(10){|i| vdc(i,base)}.join(", ")
|
||||
end
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
'http://rosettacode.org/wiki/Van_der_Corput_sequence
|
||||
'Van der Corput Sequence fucntion call = VanVanDerCorput(number,base)
|
||||
|
||||
Base2 = "0" : Base3 = "0" : Base4 = "0" : Base5 = "0"
|
||||
Base6 = "0" : Base7 = "0" : Base8 = "0" : Base9 = "0"
|
||||
|
||||
l = 1
|
||||
h = 1
|
||||
Do Until l = 9
|
||||
'Set h to the value of l after each function call
|
||||
'as it sets it to 0 - see lines 37 to 40.
|
||||
Base2 = Base2 & ", " & VanDerCorput(h,2) : h = l
|
||||
Base3 = Base3 & ", " & VanDerCorput(h,3) : h = l
|
||||
Base4 = Base4 & ", " & VanDerCorput(h,4) : h = l
|
||||
Base5 = Base5 & ", " & VanDerCorput(h,5) : h = l
|
||||
Base6 = Base6 & ", " & VanDerCorput(h,6) : h = l
|
||||
l = l + 1
|
||||
Loop
|
||||
|
||||
WScript.Echo "Base 2: " & Base2
|
||||
WScript.Echo "Base 3: " & Base3
|
||||
WScript.Echo "Base 4: " & Base4
|
||||
WScript.Echo "Base 5: " & Base5
|
||||
WScript.Echo "Base 6: " & Base6
|
||||
|
||||
'Van der Corput Sequence
|
||||
Function VanDerCorput(n,b)
|
||||
k = RevString(Dec2BaseN(n,b))
|
||||
For i = 1 To Len(k)
|
||||
VanDerCorput = VanDerCorput + (CLng(Mid(k,i,1)) * b^-i)
|
||||
Next
|
||||
End Function
|
||||
|
||||
'Decimal to Base N Conversion
|
||||
Function Dec2BaseN(q,c)
|
||||
Dec2BaseN = ""
|
||||
Do Until q = 0
|
||||
Dec2BaseN = CStr(q Mod c) & Dec2BaseN
|
||||
q = Int(q / c)
|
||||
Loop
|
||||
End Function
|
||||
|
||||
'Reverse String
|
||||
Function RevString(s)
|
||||
For j = Len(s) To 1 Step -1
|
||||
RevString = RevString & Mid(s,j,1)
|
||||
Next
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue