Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7901645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:16:36+00:00 2026-06-03T09:16:36+00:00

I have a loop and I need to return certain numbers in a pattern

  • 0

I have a loop and I need to return certain numbers in a pattern as true I have the count at my disposal as well as the number 4 and 4-1(3). I need to return 5,12,19,26,33 etc as true and the others as false.

function saturn(count,perline){
  var line_one = perline; // 5
  var line_two = perline-1; // 4
  var line_both = line_one + line_two; // 7
  var x = (perline+1)+(line_both*(Math.floor(count/(perline+1))-1));
  if(x<0) x = 0;
  var capture;
  if(perline == 1){ //if perline = 1 don't indent any
    capture = false;
  }else if(x == count){
    capture = true;
  }
  console.log("("+perline+"+1)+("+line_both+"*(Math.floor("+count+"/("+perline+"+1))-1)) ="+x);  
  console.log(count+" "+capture);
  return capture;
}

The console output.

script.js:54(4+1)+(7*(Math.floor(1/(4+1))-1)) =0
script.js:561 undefined
script.js:54(4+1)+(7*(Math.floor(2/(4+1))-1)) =0
script.js:562 undefined
script.js:54(4+1)+(7*(Math.floor(3/(4+1))-1)) =0
script.js:563 undefined
script.js:54(4+1)+(7*(Math.floor(4/(4+1))-1)) =0
script.js:564 undefined
script.js:54(4+1)+(7*(Math.floor(5/(4+1))-1)) =5
script.js:565 true
script.js:54(4+1)+(7*(Math.floor(6/(4+1))-1)) =5
script.js:566 undefined
script.js:54(4+1)+(7*(Math.floor(7/(4+1))-1)) =5
script.js:567 undefined
script.js:54(4+1)+(7*(Math.floor(8/(4+1))-1)) =5
script.js:568 undefined
script.js:54(4+1)+(7*(Math.floor(9/(4+1))-1)) =5
script.js:569 undefined
script.js:54(4+1)+(7*(Math.floor(10/(4+1))-1)) =12
script.js:5610 undefined
script.js:54(4+1)+(7*(Math.floor(11/(4+1))-1)) =12
script.js:5611 undefined
script.js:54(4+1)+(7*(Math.floor(12/(4+1))-1)) =12
script.js:5612 true
script.js:54(4+1)+(7*(Math.floor(13/(4+1))-1)) =12
script.js:5613 undefined
script.js:54(4+1)+(7*(Math.floor(14/(4+1))-1)) =12
script.js:5614 undefined
script.js:54(4+1)+(7*(Math.floor(15/(4+1))-1)) =19
script.js:5615 undefined
script.js:54(4+1)+(7*(Math.floor(16/(4+1))-1)) =19
script.js:5616 undefined
script.js:54(4+1)+(7*(Math.floor(17/(4+1))-1)) =19
script.js:5617 undefined
script.js:54(4+1)+(7*(Math.floor(18/(4+1))-1)) =19
script.js:5618 undefined
script.js:54(4+1)+(7*(Math.floor(19/(4+1))-1)) =19
script.js:5619 true
script.js:54(4+1)+(7*(Math.floor(20/(4+1))-1)) =26
script.js:5620 undefined
script.js:54(4+1)+(7*(Math.floor(21/(4+1))-1)) =26
script.js:5621 undefined
script.js:54(4+1)+(7*(Math.floor(22/(4+1))-1)) =26
script.js:5622 undefined
script.js:54(4+1)+(7*(Math.floor(23/(4+1))-1)) =26
script.js:5623 undefined
script.js:54(4+1)+(7*(Math.floor(24/(4+1))-1)) =26
script.js:5624 undefined
script.js:54(4+1)+(7*(Math.floor(25/(4+1))-1)) =33
script.js:5625 undefined
script.js:54(4+1)+(7*(Math.floor(26/(4+1))-1)) =33
script.js:5626 undefined
script.js:54(4+1)+(7*(Math.floor(27/(4+1))-1)) =33
script.js:5627 undefined
script.js:54(4+1)+(7*(Math.floor(28/(4+1))-1)) =33
script.js:5628 undefined
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:16:38+00:00Added an answer on June 3, 2026 at 9:16 am

    This is what you are trying to do?

    return (x - 5) % 7 == 0
    

    It returns true for 5, 12, 19, 26 and 33.

    EDIT: you have edited, and I still can’t understand what you, but this will not help, sorry

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number rather large, complex xml documents that I need to loop
i have the following code ..i need to loop through end of the file
I have a foreach loop in jQuery going through each 'div.panel', I need to
I have code that needs to loop and it will need to change the
I have an NSDecimal in a tight calculations loop, where I need to floor
I have a PHP script with infinite loop. I need this script running forever.
I need some help with an array and a foreach loop, I have an
I have a thread containing a runnable. I need this to loop infinitely unless
I have a loop, where I need to use the values from 2 IEnumerable's,
Possible Duplicate: PHP code to remove everything but numbers i have a loop that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.