Skip to main content
added 1 character in body
Source Link
solid.py
  • 1.6k
  • 1
  • 7
  • 19

Python, 116 bytes

Takes input a decimal number as a string, while using a recursive function to calculate the first n primes and the proposed equation of user GotCubes.

f=lambda n,i=1,p=1:n*[0]and p%i*[i]+f(n-p%i,i+1,p*i*i) c=lambda s:sum(y*(9-x)for x,y in zip(map(int,s),f(len(s))))+1 

Attempt This Online!

Python, 116 bytes

Takes input a decimal number as a string while using a recursive function to calculate the first n primes and the proposed equation of user GotCubes.

f=lambda n,i=1,p=1:n*[0]and p%i*[i]+f(n-p%i,i+1,p*i*i) c=lambda s:sum(y*(9-x)for x,y in zip(map(int,s),f(len(s))))+1 

Attempt This Online!

Python, 116 bytes

Takes input a decimal number as a string, while using a recursive function to calculate the first n primes and the proposed equation of user GotCubes.

f=lambda n,i=1,p=1:n*[0]and p%i*[i]+f(n-p%i,i+1,p*i*i) c=lambda s:sum(y*(9-x)for x,y in zip(map(int,s),f(len(s))))+1 

Attempt This Online!

Source Link
solid.py
  • 1.6k
  • 1
  • 7
  • 19

Python, 116 bytes

Takes input a decimal number as a string while using a recursive function to calculate the first n primes and the proposed equation of user GotCubes.

f=lambda n,i=1,p=1:n*[0]and p%i*[i]+f(n-p%i,i+1,p*i*i) c=lambda s:sum(y*(9-x)for x,y in zip(map(int,s),f(len(s))))+1 

Attempt This Online!