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!)
A128110 Largest prime x such that x/(n^k), rounded up, is 1 or a prime for all positive integer values of k. 1
5, 109, 163, 751, 37181, 1220423, 420001, 59757913, 16660807, 199067023, 766462903201, 641418438961, 610994816525833, 834251799269401, 46727045369489101, 21346113465023, 42439483778365061, 17596652626197454349, 1525870657210709129 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
COMMENTS
The program below is for C++ and does not work for numbers above a certain point due to integer restrictions.
LINKS
EXAMPLE
S(3)=109 because 109 is a prime, 109/3 rounded up, or 37, is a prime; 109/3^2 rounded up, or 13, is a prime; 109/3^3 rounded up, or 5, is a prime;109/3^4 rounded up, or 2, is a prime; 109/3^5 rounded up is one.
PROG
#include <iostream> #include <cmath> #include <tchar.h> using namespace std; unsigned long int sqrot; unsigned long int test; void primetest (unsigned long long int& x, bool& t){ sqrot=10000000000; test=2; while(sqrot>test && x>test && x%test!=0){ test=test+1; } if(sqrot==test || x==test){ t=true; }else{ t=false; }} int main() { int a; int b; unsigned int k; unsigned long long int c; unsigned long long int prime; unsigned long long int array[2000]; int number=2; bool t; unsigned int d=1; number=2; while(number>1){ array[1]=1; a=1; b=1; while(a<=b){ prime=number*array[a]; k=number-1; while (prime-k<= prime){ c=prime-k; primetest(c, t); if(t==true){ b++; array[b]=c; if(c>d){ d=c; }else{} }else{} k--; } a++; } cout<<d<<", "; number++; d=1; } cin>>a; return 0; }
Contribution from Max Alekseyev, May 21 2009: (Start)
(PARI) { a(n, q) = local(t, b, r); t=(q-1)*n; b=q*n; r=[]; while(1, t=nextprime(t+1); if(t>b, break); r=concat(r, [t]); ); r }
{ A128110(n, s=1) = local(m, t); m=s; t=a(n, s); for(k=1, #t, m=max(m, A128110(n, t[k])); ); m } (End)
CROSSREFS
Sequence in context: A048564 A139971 A305095 * A316755 A199307 A195561
KEYWORD
nonn
AUTHOR
Alex Smith (Indeed123(AT)gmail.com), Feb 15 2007
EXTENSIONS
Corrected and extended by Max Alekseyev, May 21 2009
STATUS
approved

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 23 08:33 EDT 2024. Contains 371905 sequences. (Running on oeis4.)