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.
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.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jun 16 2012
STATUS
approved