|
|
A213636
|
|
Remainder when n is divided by its least nondivisor.
|
|
6
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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.
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=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=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 - 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:
|
|
MATHEMATICA
|
y=120; z=2000;
t = Table[k := 1; While[Mod[n, k] == 0, k++];
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]]],
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
|
(Python)
def a(n):
k=2
while n%k==0: k+=1
return n%k
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|