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!)
A234541 Least k such that floor(n/k) + (n mod k) is a prime, or 0 if no such k exists. 1
0, 1, 1, 2, 1, 2, 1, 4, 2, 2, 1, 4, 1, 2, 3, 8, 1, 6, 1, 4, 2, 2, 1, 8, 2, 2, 5, 4, 1, 6, 1, 6, 2, 2, 3, 12, 1, 2, 3, 8, 1, 6, 1, 4, 2, 2, 1, 16, 3, 10, 3, 4, 1, 18, 3, 6, 2, 2, 1, 8, 1, 2, 6, 18, 3, 6, 1, 4, 3, 4, 1, 14, 1, 2, 9, 4, 5, 6, 1, 16, 2, 2, 1, 12, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
a(n) = 1 only if n is a prime.
a(2m) <= m, because with k=m, floor(2m/m)+(2m mod m) = 2.
a(2m+1) <= 2m: floor((2m+1)/2m) + ((2m+1) mod 2m) = 1 + 1 = 2.
LINKS
PROG
(Python)
primes = [2, 3]
primFlg = [0]*100000
primFlg[2] = primFlg[3] = 1
def appPrime(k):
for p in primes:
if k%p==0: return
if p*p > k: break
primes.append(k)
primFlg[k] = 1
for n in range(5, 100000, 6):
appPrime(n)
appPrime(n+2)
for n in range(1, 100000):
a = 0
for k in range(1, n):
c = n//k + n%k
if primFlg[c]: # if c in primes:
a = k
break
print(str(a), end=', ')
(Scheme)
;; MIT/GNU Scheme, with Aubrey Jaffer's SLIB Scheme library and function A234575bi as defined in A234575
(require 'factor) ;; For predicate prime? from SLIB-library.
(define (A234541 n) (let loop ((k 1)) (cond ((prime? (A234575bi n k)) k) ((> k n) 0) (else (loop (+ 1 k))))))
;; Antti Karttunen, Dec 29 2013
CROSSREFS
Sequence in context: A296131 A345344 A319004 * A066389 A077191 A317545
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Dec 27 2013
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 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)