OFFSET
0,3
LINKS
John Tyler Rascoe, Table of n, a(n) for n = 0..10000
EXAMPLE
a(8) = 8. So a(9) = the number of positive integers <= 9 that are not coprime to 8 (i.e., that are divisible by 2). So a(9) = 4.
MAPLE
A113469 := proc(n) option remember ; local a, i, aprev ; if n= 0 then RETURN(1) ; fi ; a :=0 ; aprev := A113469(n-1) ; for i from 1 to n do if gcd(i, aprev) <> 1 or aprev=0 then a := a+1 ; fi ; od ; RETURN(a) ; end: for n from 0 to 80 do printf("%d, ", A113469(n)) ; od ; # R. J. Mathar, Jun 07 2007
MATHEMATICA
a[n] = If[n == 0, 1, With[{a1 = a[n-1]}, Length@Select[Range[n], a1 == 0 || !CoprimeQ[#, a1]&]]];
Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 14 2024 *)
PROG
(Python)
from math import gcd
def A113469_list(n_max):
A = [1]
for n in range(n_max):
if A[-1] == 0: A.append(n+1)
else: A.append(sum(1 for k in range(n+1) if gcd(k+1, A[-1]) != 1))
return A # John Tyler Rascoe, Nov 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, May 10 2007
EXTENSIONS
More terms from R. J. Mathar, Jun 07 2007
STATUS
approved