login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A213636
Remainder when n is divided by its least nondivisor.
7
1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 4, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 4, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 4, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1
OFFSET
1,2
COMMENTS
Experimentation suggests that every positive integer occurs in this sequence and that
2 occurs only in even numbered positions,
3 occurs in only in positions that are multiples of 12,
4 occurs only in positions that are multiples of 12,
5 occurs only in positions that are multiples of 60,
6 occurs only in positions that are multiples of 60,
7 occurs only in positions that are multiples of 2520, etc.
See A213637 for positions of 1 and A213638 for positions of 2.
From Robert Israel, Jul 28 2017: (Start)
Given any positive number m, let q be a prime > m and r = A003418(q-1). Then a(n) = m if n == m (mod q) and n == 0 (mod r). By the Chinese Remainder Theorem, such n exists.
On the other hand, if a(n) = m, we must have A007978(n) > m, and then n must be divisible by A003418(q-1) where q = A007978(n) is a member of A000961 greater than m. Moreover, if q=p^j with j>1, n is divisible by p^(j-1) so m must be divisible by p^(j-1). Thus:
For m=2, A003418(2)=2.
For m=3, A007978(n) can't be 4 because m is odd, so A007978(n)>= 5 and n must be divisible by A003418(4)=12.
For m=4, A003418(4)=12.
For m=5 or 6, A003418(6)=60.
For m=7, A007978(n) can't be 8 because m is odd, and can't be 9 because m is not divisible by 3, so n must be divisible by A003418(10)=2520. (End)
LINKS
FORMULA
a(n) = n - A213635(n).
a(n) = n - m(n)*floor(n/m(n)), where m(n) = A007978(n).
EXAMPLE
a(10) = 10-3*[10/3] = 1.
MAPLE
f:= proc(n) local k;
for k from 2 do if n mod k <> 0 then return n mod k fi od
end proc:
map(f, [$1..100]); # Robert Israel, Jul 27 2017
MATHEMATICA
y=120; z=2000;
t = Table[k := 1; While[Mod[n, k] == 0, k++];
k, {n, 1, z}] (*A007978*)
Table[Floor[n/t[[n]]], {n, 1, y}] (*A213633*)
Table[n - Floor[n/t[[n]]], {n, 1, y}] (*A213634*)
Table[t[[n]]*Floor[n/t[[n]]], {n, 1, y}] (*A213635*)
t1 = Table[n - t[[n]]*Floor[n/t[[n]]],
{n, 1, z}] (* A213636 *)
Flatten[Position[t1, 1]] (* A213637 *)
Flatten[Position[t1, 2]] (* A213638 *)
rem[n_]:=Module[{lnd=First[Complement[Range[n], Divisors[n]]]}, Mod[n, lnd]]; Join[{1, 2}, Array[rem, 100, 3]] (* Harvey P. Dale, Mar 26 2013 *)
Table[Mod[n, SelectFirst[Range[n + 1], ! Divisible[n, #] &]], {n, 105}] (* Michael De Vlieger, Jul 29 2017 *)
PROG
(Scheme) (define (A213636 n) (modulo n (A007978 n))) ;; Antti Karttunen, Jul 27 2017
(Python)
def a(n):
k=2
while n%k==0: k+=1
return n%k
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 28 2017
(Python)
def A213636(n): return next(filter(None, (n%d for d in range(2, n)))) if n>2 else n # Chai Wah Wu, Feb 22 2023
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jun 16 2012
STATUS
approved