OFFSET

1,2

COMMENTS

More generally we can ask for the smallest k such that gcd(n,f(k)) = n. This sequence has f(k) = k*(k+1)*(k+2)/6. For other examples in the OEIS, see the crossrefencess.

LINKS

David A. Corneth, Table of n, a(n) for n = 1..10000

MATHEMATICA

Table[k = 1; While[! Divisible[k (k + 1) (k + 2)/6, n], k++]; k, {n, 81}] (* Michael De Vlieger, Dec 11 2015 *)

PROG

(PARI) a(n)=my(k=1); while((k*(k+1)*(k+2)/6)%n>0, k++); k \\ Anders HellstrÃ¶m, Dec 11 2015

(PARI) first(n) = { my(todo = n, i = 1, res = vector(n)); while(todo > 0, d = select(x -> x <= n, divisors(binomial(i + 2, 3))); for(j = 1, #d, if(res[d[j]] == 0, res[d[j]] = i; todo-- ) ); i++ ); res } \\ David A. Corneth, Mar 22 2021

CROSSREFS

KEYWORD

nonn

AUTHOR

Ctibor O. Zizka, Dec 11 2015

EXTENSIONS

More terms from Michael De Vlieger, Dec 11 2015

STATUS

approved