login
a(1) = 1, a(n) counts m < n for which n == a(m) (mod m).
3

%I #39 Jan 01 2020 22:02:59

%S 1,1,2,1,4,1,3,2,4,3,3,1,7,4,2,1,7,3,4,3,4,2,6,5,7,3,2,1,10,1,6,5,6,3,

%T 3,2,8,5,6,2,5,4,6,3,6,7,6,1,10,3,3,3,9,3,5,3,7,5,8,3,7,4,6,3,5,4,7,6,

%U 7,3,4,3,9,8,7,3,6,1,6,5,6

%N a(1) = 1, a(n) counts m < n for which n == a(m) (mod m).

%C I conjecture that this sequence is unbounded. Consider the first k terms of this sequence, and let L be the floor of log(k). If we count the times that each number 1,2,...,2L appears among the first k terms of this sequence, it appears that these sums form a normal distribution centered at L, so that L appears approximately k/10 times among the first k terms of this sequence. (For instance, in the first k = 10000 terms of the sequence, L = log(10000) = 9 appears 1174 times, a maximal count among any value that appears at all.) Thus the sequence appears to be unbounded.

%C The sequence is unbounded. For any k, consider k pairwise coprime integers m_1, ..., m_k. By the Chinese Remainder Theorem, there are infinitely many n such that n == a(m_j) (mod m_j) for each j, and thus a(n) >= k. - _Robert Israel_, Mar 21 2016

%H Peter Kagey, <a href="/A269427/b269427.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 1;

%e a(2) = 1 because 2 == a(1) (mod 1);

%e a(3) = 2 because 3 == a(1) (mod 1) and 3 == a(2) (mod 2);

%e a(4) = 1 because 4 == a(1) (mod 1);

%e a(5) = 4 because 5 == a(1) (mod 1), 5 == a(2) (mod 2), 5 == a(3) (mod 3), and 5 == a(4) (mod 4).

%p N:= 200: # to get a(1) to a(N)

%p A:= Vector(N,1):

%p for m from 2 to N-1 do

%p S:= [seq(A[m]+m*i,i=1..floor((N-A[m])/m))];

%p A[S]:= map(`+`,A[S],1);

%p od:

%p convert(A,list); # _Robert Israel_, Mar 21 2016

%t a[1] = 1; a[n_] := a[n] = Count[Range[n - 1], m_ /; Mod[a[m], m] == Mod[n, m]]; Table[a@ n, {n, 81}] (* _Michael De Vlieger_, Mar 21 2016 *)

%o (Java)

%o int[] terms = new int[10000];

%o terms[0] = 1;

%o for (int i = 1; i < 10000; i++) {

%o int count = 0;

%o for (int j = 0; j < i; j++) {

%o if (((i+1) - terms[j]) % (j+1) == 0) {

%o count++;

%o }

%o }

%o terms[i] = count;

%o }

%o (PARI) lista(nn) = {va = vector(nn); print1(va[1] = 1, ", "); for (n=2, nn, va[n] = sum(m=1, n-1, (Mod(va[m], m) == Mod(n, m))); print1(va[n], ", "););} \\ _Michel Marcus_, Feb 26 2016

%Y Cf. A269423.

%K easy,nonn

%O 1,3

%A _Alec Jones_, Feb 25 2016