Skip to main content
January 11, 2023
Question

Displaying multiples of 5 from 1-100, include every value which is having number "5"

  • January 11, 2023
  • 9 replies
  • 0 views

Hi All,

I have numbers between 1-100 and I want to display the 5 multiples and 5 included numbers.

Sample output: 5,10,15,20,25,30.................. 50,51,52,53,54,55,56,57,58,59,60,65,70...............95,100.

9 replies

January 11, 2023

a!localVariables(
local!sample:a!forEach(
items: enumerate(100)+1,
expression: {if(find(5,fv!index,1),fv!index,{}),
if(mod(fv!index,5),{},fv!index)
}
),
local!data:union(local!sample,local!sample),
local!data
)

January 11, 2023

a!localVariables(
  local!data:enumerate(100)+1,
  local!5divisons:{if(mod(local!data,5),{},local!data),if(find(5,local!data),local!data,{})},
  local!un:union(local!5divisons,local!5divisons),
  remove(local!un,1),
),

Once try this code 

January 11, 2023

I didn't get the exact output But helpful

January 12, 2023

a!localVariables(
  local!data:a!forEach(
    items: enumerate(100)+1,
    expression: {if(mod(fv!index,5),{},fv!item),if(find(5,fv!item),fv!item,{})}
  ),
  union(local!data,local!data)
)

once try this

medap0001
January 13, 2023

a!forEach(
items: enumerate(100),
expression: {
if(
mod(fv!item,5),
{},
fv!item
)
}
)

davel001150
January 13, 2023

(enumerate(20) + 1)*5

abhayd3663
February 12, 2023

Very interesting to see different ways to do it. However I liked this one most.

ayusha3676
February 12, 2023

a!forEach(
  items: enumerate(100)+1,
  expression: if(or(
    mod(fv!item,5)=0,
    find(5,fv!item)<>0
  ),
  fv!item,
  {}
  )

)

medap0001
March 4, 2024

a!localVariables(
  local!data: a!forEach(
    items: enumerate(100)+1,
    expression: append(if(find(5,fv!item),fv!item,{}),if(mod(fv!item,5),{},fv!item)),
  ),
  local!uniqueData:union(local!data,local!data),
  local!uniqueData
)