Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A124202
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A124202 a(n) = median of the largest prime dividing a random n-digit number. +0
3
3, 12, 53, 229, 947, 3863, 15731 (list; graph; listen)
OFFSET

1,1

COMMENT

A randomly selected n-digit number (uniformly distributed on 10^(n-1) to 10^n-1) has at least a 50% probability of having a prime factor at least as large as a(n).

REFERENCES

D. E. Knuth, The Art of Computer Programming, Seminumerical Algorithms, Addison-Wesley, Reading, MA, 1969, Vol. 2.

EXAMPLE

The largest prime divisors of the non-unit 1-digit numbers are 2, 3, 2, 5, 3, 7, 2 and 3 respectively, with median 3.

Of the 90 2-digit numbers, there are 45 whose largest prime divisor is 11 or less and 45 whose largest prime divisor is 13 or greater, so any of 11, 12, or 13 could be used for the second term, although the arithmetic average of the endpoints is commonly used.

MATHEMATICA

f[n_] := Block[{k = If[n == 1, 1, 0], lst = {}, pt = 10^(n - 1)}, While[k < 9*pt, AppendTo[lst, FactorInteger[pt + k][[ -1, 1]]]; k++ ]; Median@ lst]; (* Robert G. Wilson v (rgwv(at)rgwv.com), Dec 14 2006 *)

PROGRAM

n = 1;

a = 2 | 3 | 2 | 5 | 3 | 7 | 2 | 3;

meana = meanc(a);

mediana = median(a);

format /rdn 1, 0;

print n; ; "-digit numbers:";

print " Median = "; ; mediana;

format /rdn 10, 5;

print " Mean = "; ; meana;

print;

b = 1 | a;

dim = 1;

_01: wait;

n = n+1;

dim = 10*dim;

a = b | zeros(9*dim, 1);

i = dim;

do until i == 10*dim;

if i == 2*floor(i/2);

a[i] = a[i/2];

else;

p = firstp(i);

if p == i;

a[i] = i;

else;

a[i] = a[i/p];

endif;

endif;

i = i+1;

endo;

b = a[dim:10*dim-1];

meana = meanc(b);

mediana = median(b);

format /rdn 1, 0;

print n; ; "-digit numbers:";

print " Median = "; ; mediana;

format /rdn 10, 5;

print " Mean = "; ; meana;

print;

b = a;

goto _01;

proc firstp(n);

local i;

i = 3;

do until i > sqrt(n);

if n == i*floor(n/i);

retp(i);

endif;

i = i+2;

endo;

retp(n);

endp;

CROSSREFS

Cf. A046731.

Sequence in context: A010736 A007198 A000256 this_sequence A138269 A026781 A110122

Adjacent sequences: A124199 A124200 A124201 this_sequence A124203 A124204 A124205

KEYWORD

base,nonn

AUTHOR

Mark Thornquist (mthornqu(AT)fhcrc.org), Dec 07 2006

EXTENSIONS

Edited by Robert G. Wilson v (rgwv(at)rgwv.com), Dec 14 2006

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified July 26 13:41 EDT 2008. Contains 142293 sequences.


AT&T Labs Research