OFFSET
1,3
COMMENTS
Note the indexing: the domain starts from 1, while the range includes also zero.
LINKS
FORMULA
PROG
(Scheme, with memoization-macro definec)
(definec (A285111 n) (cond ((<= n 2) (- n 1)) ((not (zero? (A008683 n))) (* 2 (A285111 (A013928 n)))) (else (+ 1 (* 2 (A285111 (A285328 n)))))))
(Python)
from operator import mul
from sympy import primefactors
from sympy.ntheory.factor_ import core
from functools import reduce
def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
def a285328(n):
if core(n) == n: return 1
k=n - 1
while k>0:
if a007947(k) == a007947(n): return k
else: k-=1
def a013928(n): return sum([1 for i in range(1, n) if core(i) == i])
def a(n):
if n<3: return n - 1
if core(n)==n: return 2*a(a013928(n))
else: return 1 + 2*a(a285328(n))
print([a(n) for n in range(1, 121)]) # Indranil Ghosh, Apr 17 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 17 2017
STATUS
approved