login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A109687 Smallest number ending with the digits of n that has exactly n prime factors (counted with multiplicity). 1

%I #5 Mar 31 2012 10:26:37

%S 11,22,63,24,405,96,2187,1408,124659,65610,4271211,38912,37614213,

%T 40507614,326836215,802816,10010754117,2496709818,23202182619,

%U 14417920,886805499321,76709256822,1474909801623,25165824,3922632451125

%N Smallest number ending with the digits of n that has exactly n prime factors (counted with multiplicity).

%e a(5)=405 since 405=3*3*3*3*5 (5 factors) and ends with 5 and is the smallest such number

%o Program from _David Wasserman_, Sep 19 2008: (Start)

%o (PARI) digitcount(n, base = 10) = local(d); if (n == 0, return(1)); d = 1 + floor(log(n)/log(base)); while (n >= base^d, d++); while (n < base^(d - 1), d--); d;

%o {

%o a(n) =

%o local(r, num2, num5, d, M, pLeft, mainP, searchP, fixed, x, rNeeded, y, nextP);

%o r = n;

%o d = digitcount(n);

%o while (num2 < d && !(r%2),

%o num2++;

%o r = r/2

%o );

%o while (num5 < d && !(r%5),

%o num5++;

%o r = r/5

%o );

%o M = 10^d/2^num2/5^num5;

%o pLeft = n - num2 - num5;

%o mainP = if (num2 == d, 2, 3);

%o searchP = min(4, pLeft);

%o fixed = 2^num2*5^num5;

%o x = mainP^(pLeft - searchP);

%o rNeeded = lift(Mod(r, M)/Mod(x, M));

%o while (bigomega(rNeeded) != searchP,

%o rNeeded += M

%o );

%o y = fixed*x*rNeeded;

%o if (mainP == 2,

%o nextP = 3,

%o nextP = if (num5 == d, 5, 7)

%o );

%o while (searchP < pLeft && fixed*x*nextP^(1 + searchP)/mainP < y,

%o searchP++;

%o x /= mainP

%o );

%o rNeeded = lift(Mod(r, M)/Mod(x, M));

%o while (bigomega(rNeeded) != searchP,

%o rNeeded += M

%o );

%o return(fixed*x*rNeeded);

%o } (End)

%Y Cf. A109665 [From _David Wasserman_, Sep 30 2008]

%K base,nonn

%O 1,1

%A _Erich Friedman_, Aug 07 2005

%E More terms from _David Wasserman_, Sep 18 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 23:15 EDT 2024. Contains 371798 sequences. (Running on oeis4.)