OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..12868
FORMULA
MATHEMATICA
(* First, load the function f at A025487, then: *)
With[{s = Union@ Flatten@ f@ 10}, TakeWhile[#, # != 0 &] &@ Map[If[# > Max@ s, 0, FirstPosition[s, #][[1]] ] &[(Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1])*2^IntegerExponent[#, 2]] &, s]] (* Michael De Vlieger, Jan 11 2020 *)
PROG
(PARI)
upto_e = 101;
A283980(n) = {my(f=factor(n)); prod(i=1, #f~, my(p=f[i, 1], e=f[i, 2]); if(p==2, 6, nextprime(p+1))^e)}; \\ From A283980
A330683list(e) = { my(lista = List([1, 2]), i=2, u = 2^e, t, v025487); while(lista[i] != u, if(2*lista[i] <= u, listput(lista, 2*lista[i]); t = A283980(lista[i]); if(t <= u, listput(lista, t))); i++); v025487 = vecsort(Vec(lista)); lista = List([]); for(i=1, oo, if(!(t=vecsearch(v025487, A283980(v025487[i]))), return(Vec(lista)), listput(lista, t))); };
v330683 = A330683list(upto_e);
A330683(n) = v330683[n];
(Python)
from math import prod
from itertools import count, takewhile
from functools import lru_cache
from sympy import prime, integer_log, primorial, nextprime, factorint
from oeis_sequences.OEISsequences import bisection
def A330683(n):
@lru_cache(maxsize=None)
def g(x, m, j): return sum(g(x//(prime(m)**i), m-1, i) for i in range(j, integer_log(x, prime(m))[0]+1)) if m-1 else max(0, x.bit_length()-j)
def f(x): return 1+sum(g(x, k, 1) for k in takewhile(lambda y:primorial(y)<=x, count(1)))
return f(prod(nextprime(p)**e if p>2 else 3**e<<e for p, e in factorint(bisection(lambda x:n+x-f(x), n, n)).items())) # Chai Wah Wu, Mar 27 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 26 2019
STATUS
approved
