Skip to main content
deleted 50 characters in body
Source Link
emanresu A
  • 44.2k
  • 5
  • 100
  • 240

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function
Commonmark migration
Source Link

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

#How it works

How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

#How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function
shortened from LDpϹLsKg<Õ to LDpÈÏg<Õ
Source Link
space junk
  • 315
  • 2
  • 6

05AB1E, 1111 8 bytes

LDpϹLsKg<ÕLDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

#How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   ÏÈ          # takesis elementsthe ofelement theeven? first(does list05AB1E andnot removeshave thema 
 logical not?)
    Ï         # if thepush indexelements inof the secondfirst list is a 0
    ¹L        # getswhere the same list [1 .. a]index fromin the input
      s        # rotatessecond thelist stackis 1
      g< K      # pushes all elements offinds the completelength listand thatsubtracts aren't1 in(as the list of primes
              # we now have a list of composites (andcontains 1) less than the input
         g<   # finds the length of# this list and subtracts 1is (asthe 1not ispi included)function
       Õ    Õ  # euler totient function

I'm quite adamant the process of finding the composites can be shortened though - will give it a shot

05AB1E, 11 bytes

LDpϹLsKg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

#How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   Ï          # takes elements of the first list and removes them 
               # if the index in the second list is a 0
    ¹L        # gets the same list [1 .. a] from the input
      s       # rotates the stack 
       K      # pushes all elements of the complete list that aren't in the list of primes
              # we now have a list of composites (and 1) less than the input
         g<   # finds the length of this list and subtracts 1 (as 1 is included)
           Õ  # euler totient function

I'm quite adamant the process of finding the composites can be shortened though - will give it a shot

05AB1E, 11 8 bytes

LDpÈÏg<Õ

Try it online!

This might be non competing - I can't find out when 05AB1E was made.

#How it works

L             # this gets us the list of numbers [1 .. a]
 D            # duplicates this list
  p           # applies isPrime to each element of the list, vectorised.
   È          # is the element even? (does 05AB1E not have a logical not?)
    Ï         # push elements of the first list where the same index in the 
              # second list is 1
     g<       # finds the length and subtracts 1 (as the list contains 1)
              # this is the not pi function
       Õ      # euler totient function
Source Link
space junk
  • 315
  • 2
  • 6
Loading